diff --git a/appinfo/routes.php b/appinfo/routes.php index ff58882d..e1c88f9a 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -52,8 +52,8 @@ return [ // API Routes ['name' => 'Days#days', 'url' => '/api/days', 'verb' => 'GET'], - ['name' => 'Days#day', 'url' => '/api/days/{id}', 'verb' => 'GET'], - ['name' => 'Days#dayPost', 'url' => '/api/days', 'verb' => 'POST'], + ['name' => 'Days#day', 'url' => '/api/days', 'verb' => 'POST'], + ['name' => 'Days#dayGet', 'url' => '/api/days/{id}', 'verb' => 'GET'], ['name' => 'Folders#sub', 'url' => '/api/folders/sub', 'verb' => 'GET'], ['name' => 'Clusters#list', 'url' => '/api/clusters/{backend}', 'verb' => 'GET'], diff --git a/lib/Controller/DaysController.php b/lib/Controller/DaysController.php index 696e14bc..187c5966 100644 --- a/lib/Controller/DaysController.php +++ b/lib/Controller/DaysController.php @@ -61,13 +61,12 @@ class DaysController extends GenericApiController * @NoAdminRequired * * @PublicPage + * + * @param int[] $dayIds */ - public function day(string $id): Http\Response + public function day(array $dayIds): Http\Response { - return Util::guardEx(function () use ($id) { - // Split at commas and convert all parts to int - $dayIds = array_map(static fn ($p) => (int) $p, explode(',', $id)); - + return Util::guardEx(function () use ($dayIds) { // Run actual query $list = $this->tq->getDay( $dayIds, @@ -91,12 +90,11 @@ class DaysController extends GenericApiController * @NoAdminRequired * * @PublicPage - * - * @param int[] $dayIds */ - public function dayPost(array $dayIds): Http\Response + public function dayGet(string $id): Http\Response { - return $this->day(implode(',', $dayIds)); + // Split at commas and convert all parts to int + return $this->day(array_map(static fn ($p) => (int) $p, explode(',', $id))); } /**