diff --git a/backend/app/Http/Controllers/SetController.php b/backend/app/Http/Controllers/SetController.php new file mode 100644 index 0000000..e432739 --- /dev/null +++ b/backend/app/Http/Controllers/SetController.php @@ -0,0 +1,26 @@ + $set->getId(), + 'name' => $set->getName(), + ]; + }, $this->listSets->execute()); + + return new JsonResponse(['sets' => $sets]); + } +} diff --git a/backend/app/Set/UseCases/ListSets/ListSets.php b/backend/app/Set/UseCases/ListSets/ListSets.php new file mode 100644 index 0000000..d4e80df --- /dev/null +++ b/backend/app/Set/UseCases/ListSets/ListSets.php @@ -0,0 +1,21 @@ + + */ + public function execute(): array + { + return $this->setRepository->all(); + } +} diff --git a/backend/routes/api.php b/backend/routes/api.php index d471fcf..62384a9 100644 --- a/backend/routes/api.php +++ b/backend/routes/api.php @@ -1,6 +1,7 @@ group(function (): void { Route::get('/me', [AuthController::class, 'me']); + Route::get('/sets', [SetController::class, 'index']); Route::post('/logout', [AuthController::class, 'logout']); });