diff --git a/app/Plan/UseCases/CreatePlan.php b/app/Plan/UseCases/CreatePlan.php index cf9a3d2..c499a8b 100644 --- a/app/Plan/UseCases/CreatePlan.php +++ b/app/Plan/UseCases/CreatePlan.php @@ -2,6 +2,7 @@ namespace App\Plan\UseCases; +use App\Exceptions\BadRequestException; use App\Node\NodeRepository; use App\Plan\CreatePlanDto; use App\Plan\Plan; @@ -28,6 +29,18 @@ class CreatePlan */ public function execute(CreatePlanRequest $request): Plan { + if ($request->userId === null) { + throw new BadRequestException('userId is required'); + } + + if ($request->textId === null) { + throw new BadRequestException('textId is required'); + } + + if ($request->name === null) { + throw new BadRequestException('name is required'); + } + $userId = $request->userId; $user = $this->userRepo->find($userId); if ($user === null) {