followup.

This commit is contained in:
abdulmohsen
2024-03-05 19:22:45 +03:00
parent d7d62b622f
commit 42a6cdf4ac
6 changed files with 11 additions and 11 deletions

View File

@@ -28,7 +28,7 @@ final class Index
$urlPath = $request->getUri()->getPath(); $urlPath = $request->getUri()->getPath();
$response = [ $response = [
'data' => [], 'backends' => [],
'links' => [ 'links' => [
'self' => (string)$apiUrl, 'self' => (string)$apiUrl,
], ],
@@ -45,7 +45,7 @@ final class Index
'self' => (string)$apiUrl->withPath($urlPath . '/' . $backend['name']), 'self' => (string)$apiUrl->withPath($urlPath . '/' . $backend['name']),
]; ];
$response['data'][] = $backend; $response['backends'][] = $backend;
} }
return api_response($response, HTTP_STATUS::HTTP_OK, []); return api_response($response, HTTP_STATUS::HTTP_OK, []);

View File

@@ -35,8 +35,8 @@ final class View
'list' => (string)$apiUrl->withPath(parseConfigValue(self::URL)), 'list' => (string)$apiUrl->withPath(parseConfigValue(self::URL)),
], ],
]; ];
return api_response($response, HTTP_STATUS::HTTP_OK, []); return api_response(['backend' => $response], HTTP_STATUS::HTTP_OK, []);
} }
} }

View File

@@ -277,7 +277,7 @@ final class Index
'last_page' => @ceil($total / $perpage), 'last_page' => @ceil($total / $perpage),
], ],
'filters' => $filters, 'filters' => $filters,
'data' => [], 'history' => [],
'links' => [ 'links' => [
'self' => (string)$getUri, 'self' => (string)$getUri,
'first_url' => $firstUrl, 'first_url' => $firstUrl,
@@ -311,7 +311,7 @@ final class Index
], ],
]; ];
$response['data'][] = $item; $response['history'][] = $item;
} }
return api_response($response, HTTP_STATUS::HTTP_OK, []); return api_response($response, HTTP_STATUS::HTTP_OK, []);

View File

@@ -46,6 +46,6 @@ final readonly class View
], ],
]; ];
return api_response($item, HTTP_STATUS::HTTP_OK, []); return api_response(['history' => $item], HTTP_STATUS::HTTP_OK, []);
} }
} }

View File

@@ -21,7 +21,7 @@ final class Index
$urlPath = rtrim($request->getUri()->getPath(), '/'); $urlPath = rtrim($request->getUri()->getPath(), '/');
$response = [ $response = [
'data' => [], 'tasks' => [],
'links' => [ 'links' => [
'self' => (string)$apiUrl, 'self' => (string)$apiUrl,
], ],
@@ -33,12 +33,12 @@ final class Index
fn($k) => false === in_array($k, ['command', 'args']), fn($k) => false === in_array($k, ['command', 'args']),
ARRAY_FILTER_USE_KEY ARRAY_FILTER_USE_KEY
); );
$task['links'] = [ $task['links'] = [
'self' => (string)$apiUrl->withPath($urlPath . '/' . ag($task, 'name')), 'self' => (string)$apiUrl->withPath($urlPath . '/' . ag($task, 'name')),
]; ];
$response['data'][] = $task; $response['tasks'][] = $task;
} }
return api_response($response, HTTP_STATUS::HTTP_OK, []); return api_response($response, HTTP_STATUS::HTTP_OK, []);

View File

@@ -35,6 +35,6 @@ final class View
], ],
]; ];
return api_response($response, HTTP_STATUS::HTTP_OK); return api_response(['task' => $response], HTTP_STATUS::HTTP_OK);
} }
} }