From 32cbf4229c0196741b9966613cece6e42997c3ad Mon Sep 17 00:00:00 2001 From: yisroel Date: Wed, 6 May 2026 15:25:07 +0300 Subject: [PATCH] implement ListUserPosts use case validates userId > 0, delegates to PostRepository->findByUserId. 54 tests pass. --- .../UseCases/ListUserPosts/ListUserPosts.php | 28 +++++++++++++++++++ .../ListUserPosts/ListUserPostsRequest.php | 10 +++++++ 2 files changed, 38 insertions(+) create mode 100644 backend/app/Post/UseCases/ListUserPosts/ListUserPosts.php create mode 100644 backend/app/Post/UseCases/ListUserPosts/ListUserPostsRequest.php diff --git a/backend/app/Post/UseCases/ListUserPosts/ListUserPosts.php b/backend/app/Post/UseCases/ListUserPosts/ListUserPosts.php new file mode 100644 index 0000000..c0c305e --- /dev/null +++ b/backend/app/Post/UseCases/ListUserPosts/ListUserPosts.php @@ -0,0 +1,28 @@ +userId <= 0) { + throw new BadRequestException('userId must be positive'); + } + + return $this->postRepo->findByUserId($request->userId); + } +} diff --git a/backend/app/Post/UseCases/ListUserPosts/ListUserPostsRequest.php b/backend/app/Post/UseCases/ListUserPosts/ListUserPostsRequest.php new file mode 100644 index 0000000..6a5a6a5 --- /dev/null +++ b/backend/app/Post/UseCases/ListUserPosts/ListUserPostsRequest.php @@ -0,0 +1,10 @@ +