Skip to content

Conversation

zigzagdev
Copy link
Owner

Description

This PR finalises and merges the Application layer logic responsible for coordinating post-related retrieval flows. It introduces the GetOthersAllPostsUseCase, which delegates query operations to the GetPostQueryServiceInterface, returning paginated data encapsulated in a PaginationDto.

This marks the integration of the application logic responsible for retrieving public posts made by users other than the currently authenticated one.


What’s Included

  • GetOthersAllPostsUseCase:

  • Handles input parameters: userId, perPage, currentPage

  • Delegates query to GetPostQueryServiceInterface::getOthersAllPosts

  • Returns PaginationDto composed of PostEntity instances

  • Application-layer isolation:

  • No knowledge of Eloquent or database structure

  • Works purely with DTOs and interfaces

  • Supporting test (in separate PR or module):

    • Ensures delegation to the query service
    • Validates type and structure of returned pagination data

@zigzagdev zigzagdev requested a review from Copilot July 5, 2025 09:11
@zigzagdev zigzagdev self-assigned this Jul 5, 2025
@zigzagdev zigzagdev linked an issue Jul 5, 2025 that may be closed by this pull request
@zigzagdev zigzagdev merged commit 5fba67a into feature/see-other-posts Jul 5, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR merges the application-layer logic for retrieving public posts made by other users by introducing a dedicated use case and its supporting test.

  • Adds GetOthersAllPostsUseCase to delegate post retrieval to the query service and return PaginationDto
  • Keeps application layer independent of persistence by relying on DTOs and interfaces
  • Provides a unit test for the new use case

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/app/Post/Infrastructure/QueryService/GetPostQueryService.php Removed stray blank lines before the pagination return call
src/app/Post/Application/UseCase/GetOthersAllPostsUseCase.php Introduced the new use case handling parameters and returning DTOs
src/app/Post/Application/ApplicationTest/GetOthersAllPostsUseCaseTest.php Added a test to verify that the use case returns a PaginationDto
Comments suppressed due to low confidence (3)

src/app/Post/Application/ApplicationTest/GetOthersAllPostsUseCaseTest.php:1

  • Test classes should be located in the tests directory and use the Tests namespace to avoid mixing test and production code.
<?php

src/app/Post/Application/ApplicationTest/GetOthersAllPostsUseCaseTest.php:39

  • The mock allows currentPage to be zero, but pagination typically starts at 1; consider changing the condition to $arg > 0 to match expected input constraints.
                Mockery::on(fn($arg) => is_int($arg) && $arg >= 0) // currentPage

class GetOthersAllPostsUseCase
{
public function __construct(
private readonly GetPostQueryServiceInterface $queryService
Copy link

Copilot AI Jul 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] There's an extra space between readonly and the type declaration; consider normalizing spacing to follow PSR-12 style.

Suggested change
private readonly GetPostQueryServiceInterface $queryService
private readonly GetPostQueryServiceInterface $queryService

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

See Other Posts Application

1 participant