create scheduled node with request
This commit is contained in:
parent
49328404c9
commit
40d8032569
2 changed files with 36 additions and 0 deletions
24
app/ScheduledNode/UseCases/CreateScheduledNode.php
Normal file
24
app/ScheduledNode/UseCases/CreateScheduledNode.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace App\ScheduledNode\UseCases;
|
||||
|
||||
use App\ScheduledNode\ScheduledNode;
|
||||
use App\ScheduledNode\CreateScheduledNodeDto;
|
||||
use App\ScheduledNode\ScheduledNodeRepository;
|
||||
|
||||
class CreateScheduledNode
|
||||
{
|
||||
public function __construct(
|
||||
private ScheduledNodeRepository $scheduledNodeRepo,
|
||||
) {}
|
||||
|
||||
public function execute(
|
||||
CreateScheduledNodeRequest $request
|
||||
): ScheduledNode {
|
||||
return $this->scheduledNodeRepo->create(
|
||||
new CreateScheduledNodeDto(
|
||||
date: $request->date,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
12
app/ScheduledNode/UseCases/CreateScheduledNodeRequest.php
Normal file
12
app/ScheduledNode/UseCases/CreateScheduledNodeRequest.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace App\ScheduledNode\UseCases;
|
||||
|
||||
use DateTimeImmutable;
|
||||
|
||||
class CreateScheduledNodeRequest
|
||||
{
|
||||
public function __construct(
|
||||
public DateTimeImmutable $date,
|
||||
) {}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue