wrap set layout input

This commit is contained in:
Yisroel Baum 2026-08-09 09:38:46 +03:00
parent b4a2107724
commit fac49e43d4
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
3 changed files with 14 additions and 3 deletions

View file

@ -6,6 +6,7 @@ use App\Exceptions\NotFoundException;
use App\Set\Set; use App\Set\Set;
use App\Set\UseCases\GetSetLayout\ElementLayoutNode; use App\Set\UseCases\GetSetLayout\ElementLayoutNode;
use App\Set\UseCases\GetSetLayout\GetSetLayout; use App\Set\UseCases\GetSetLayout\GetSetLayout;
use App\Set\UseCases\GetSetLayout\GetSetLayoutRequest;
use App\Set\UseCases\ListSets\ListSets; use App\Set\UseCases\ListSets\ListSets;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
@ -31,7 +32,9 @@ class SetController extends Controller
public function show(int $setId): JsonResponse public function show(int $setId): JsonResponse
{ {
try { try {
$layout = $this->getSetLayout->execute($setId); $layout = $this->getSetLayout->execute(
new GetSetLayoutRequest(setId: $setId),
);
} catch (NotFoundException $exception) { } catch (NotFoundException $exception) {
return new JsonResponse( return new JsonResponse(
['error' => $exception->getMessage()], ['error' => $exception->getMessage()],

View file

@ -17,9 +17,9 @@ class GetSetLayout
/** /**
* @throws NotFoundException * @throws NotFoundException
*/ */
public function execute(int $setId): SetLayout public function execute(GetSetLayoutRequest $request): SetLayout
{ {
$set = $this->setRepository->find($setId); $set = $this->setRepository->find($request->setId);
if ($set === null) { if ($set === null) {
throw new NotFoundException('set not found'); throw new NotFoundException('set not found');
} }

View file

@ -0,0 +1,8 @@
<?php
namespace App\Set\UseCases\GetSetLayout;
final readonly class GetSetLayoutRequest
{
public function __construct(public int $setId) {}
}