-
Notifications
You must be signed in to change notification settings - Fork 0
Integrate pagination infrastructure into show-post-index branch #203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate pagination infrastructure into show-post-index branch #203
Conversation
…tion-dto Implement Pagination DTO and factory for application-layer pagination handling
…tion-viewmodel Implement Pagination ViewModel and factory for presentation-layer formatting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self review
- Pagination logic is kept out of domain layer as intended
- Presentation layer prepares a clean API response structure via ViewModel
- Factory patterns prevent duplication and centralise transformation logic
-
show-post-index
remains focused on fetching and displaying data, now powered by structured pagination - No breaking changes introduced to existing application contracts
There was a problem hiding this 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 integrates pagination functionality into the post index view by introducing new DTO, ViewModel, factories, and accompanying tests.
- Introduces a Pagination DTO and a corresponding ViewModel
- Implements factory classes to create DTOs and ViewModels from paginated data
- Adds tests to verify DTO and ViewModel behavior
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/app/Common/Presentation/ViewModelFactory/PaginationFactory.php | Creates a ViewModel from the Pagination DTO and data array |
src/app/Common/Presentation/ViewModel/Pagination.php | Defines the Pagination ViewModel with a toArray() method |
src/app/Common/Presentation/PresentationTest/PaginationViewModelTest.php | Tests the Pagination ViewModel, including type and value checks |
src/app/Common/Application/DtoFactory/PaginationFactory.php | Builds the Pagination DTO from the provided array data |
src/app/Common/Application/Dto/Pagination.php | Implements the Pagination DTO with accessor methods and toArray() |
src/app/Common/Application/ApplicationTest/PaginationDtoTest.php | Verifies the Pagination DTO’s type and value assignment |
Files not reviewed (1)
- .idea/workspace.xml: Language not supported
Comments suppressed due to low confidence (1)
src/app/Common/Presentation/PresentationTest/PaginationViewModelTest.php:127
- The test iterates over expected keys and checks for corresponding getter methods, yet the Pagination view model does not implement any getters. Consider adding explicit getters or updating the test to validate the output of toArray() to strengthen test coverage.
if (method_exists($viewModel, $getter)) {
private ?string $from = null, | ||
private ?string $to = null, |
Copilot
AI
Jun 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'from' property is declared as a nullable string, but the view model expects an integer. Consider changing its type to int (and likewise for 'to') to ensure consistency across layers.
private ?string $from = null, | |
private ?string $to = null, | |
private ?int $from = null, | |
private ?int $to = null, |
Copilot uses AI. Check for mistakes.
Description
This PR merges the
pagination
implementation into theshow-post-index
feature branch.The merged changes include:
Pagination
DTO in the application layer for encapsulating paginated data and metadataPaginationFactory
for constructing the DTO from Laravel paginator arrayPagination
ViewModel and corresponding ViewModelFactory for formatting the pagination structure in the presentation layertoArray()
response structure standardised withdata
andpagination
keys