Skip to content

Commit

Permalink
feat: Added more data to api endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
lewislarsen committed Aug 11, 2024
1 parent d928ff7 commit dd6c28a
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/Http/Resources/BackupDestinationResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function toArray(Request $request): array
'user_id' => $this->resource->user_id,
'label' => $this->resource->label,
'type' => $this->resource->type,
'type_human' => $this->resource->type(),
'created_at' => $this->resource->created_at,
'updated_at' => $this->resource->updated_at,
];
Expand Down
1 change: 1 addition & 0 deletions app/Http/Resources/BackupTaskResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function toArray(Request $request): array
'appended_filename' => $this->resource->appended_filename ?? null,
'path' => $this->resource->store_path,
],
'notification_streams_count' => $this->resource->notificationStreams()->count ?? 0,
'status' => $this->resource->status,
'has_isolated_credentials' => ! is_null($this->resource->isolated_username) && ! is_null($this->resource->isolated_password),
'created_at' => $this->resource->created_at,
Expand Down
1 change: 1 addition & 0 deletions app/Http/Resources/NotificationStreamResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function toArray(Request $request): array
'user_id' => $this->resource->user_id,
'label' => $this->resource->label,
'type' => $this->resource->type,
'type_human' => $this->resource->formatted_type,
'notifications' => [
'on_success' => (bool) $this->resource->receive_successful_backup_notifications,
'on_failure' => (bool) $this->resource->receive_failed_backup_notifications,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
$response->assertStatus(200)
->assertJsonStructure([
'data' => [
'*' => ['id', 'label', 'type', 'user_id', 'created_at', 'updated_at'],
'*' => ['id', 'label', 'type', 'type_human', 'user_id', 'created_at', 'updated_at'],
],
])
->assertJsonCount(3, 'data')
Expand Down
1 change: 1 addition & 0 deletions tests/Feature/BackupTasks/Api/BackupTaskApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
'appended_filename',
'path',
],
'notification_streams_count',
'status',
'has_isolated_credentials',
'created_at',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
'user_id',
'label',
'type',
'type_human',
'notifications' => [
'on_success',
'on_failure',
Expand Down

0 comments on commit dd6c28a

Please sign in to comment.