validate get todays schedule date
This commit is contained in:
parent
4e2904a2b4
commit
f0fd076fb9
1 changed files with 6 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\ScheduledNode\UseCases;
|
||||
|
||||
use App\Exceptions\BadRequestException;
|
||||
use App\ScheduledNode\ScheduledNode;
|
||||
use App\ScheduledNode\ScheduledNodeRepository;
|
||||
use App\User\UserRepository;
|
||||
|
|
@ -16,9 +17,14 @@ class GetTodaysSchedule
|
|||
|
||||
/**
|
||||
* @return ScheduledNode[]
|
||||
*
|
||||
* @throws BadRequestException
|
||||
*/
|
||||
public function execute(GetTodaysScheduleRequest $request): array
|
||||
{
|
||||
if ($request->date === null) {
|
||||
throw new BadRequestException('date is required');
|
||||
}
|
||||
$date = new DateTimeImmutable($request->date);
|
||||
$userId = $request->userId;
|
||||
$user = $this->userRepo->find($userId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue