add text to node
This commit is contained in:
parent
e55133ceac
commit
c0994d806e
5 changed files with 17 additions and 0 deletions
|
|
@ -5,16 +5,20 @@ namespace App\Node\UseCases;
|
|||
use App\Node\Node;
|
||||
use App\Node\CreateNodeDto;
|
||||
use App\Node\NodeRepository;
|
||||
use App\Text\TextRepository;
|
||||
|
||||
class CreateNode
|
||||
{
|
||||
public function __construct(
|
||||
private NodeRepository $nodeRepo,
|
||||
private TextRepository $textRepo,
|
||||
) {}
|
||||
|
||||
public function execute(CreateNodeRequest $request): Node
|
||||
{
|
||||
$text = $this->textRepo->find($request->textId);
|
||||
return $this->nodeRepo->create(new CreateNodeDto(
|
||||
text: $text,
|
||||
title: $request->title,
|
||||
));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue