add plan to scheduled node
This commit is contained in:
parent
fd0ee57149
commit
412a74e390
5 changed files with 15 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\ScheduledNode\UseCases;
|
||||
|
||||
use App\Plan\PlanRepository;
|
||||
use App\ScheduledNode\ScheduledNode;
|
||||
use App\ScheduledNode\CreateScheduledNodeDto;
|
||||
use App\ScheduledNode\ScheduledNodeRepository;
|
||||
|
|
@ -10,14 +11,17 @@ class CreateScheduledNode
|
|||
{
|
||||
public function __construct(
|
||||
private ScheduledNodeRepository $scheduledNodeRepo,
|
||||
private PlanRepository $planRepo,
|
||||
) {}
|
||||
|
||||
public function execute(
|
||||
CreateScheduledNodeRequest $request
|
||||
): ScheduledNode {
|
||||
$plan = $this->planRepo->find($request->planId);
|
||||
return $this->scheduledNodeRepo->create(
|
||||
new CreateScheduledNodeDto(
|
||||
date: $request->date,
|
||||
plan: $plan,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue