add start and end date and test for null entries

This commit is contained in:
Yisroel Baum 2026-04-23 20:44:14 +03:00
parent f8a1c2616d
commit a752ff9ba5
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
3 changed files with 56 additions and 0 deletions

View file

@ -42,6 +42,14 @@ class CreatePlan
throw new BadRequestException('name is required');
}
if ($request->dateStart === null) {
throw new BadRequestException('date start is required');
}
if ($request->dateEnd === null) {
throw new BadRequestException('date end is required');
}
$userId = $request->userId;
$user = $this->userRepo->find($userId);
if ($user === null) {

View file

@ -8,5 +8,7 @@ class CreatePlanRequest
public ?int $userId,
public ?int $textId,
public ?string $name,
public ?string $dateStart,
public ?string $dateEnd,
) {}
}