implement CreatePost use case

trims title and body, rejects empty (post-trim) values with
BadRequest. supplies createdAt from injected Clock. persists
through PostRepository->create and returns the resulting Post.
44 tests pass.
This commit is contained in:
yisroel 2026-05-06 15:23:21 +03:00
parent 504554bf7f
commit 4a4e046de4
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
2 changed files with 52 additions and 0 deletions

View file

@ -0,0 +1,12 @@
<?php
namespace App\Post\UseCases\CreatePost;
class CreatePostRequest
{
public function __construct(
public int $userId,
public ?string $title,
public ?string $body,
) {}
}