Vb 6479 add sort order to paged results#366
Vb 6479 add sort order to paged results#366Dhiraj Shetty (dhirajshettymoj) merged 11 commits intomainfrom
Conversation
…lts are not repeated in subsequent paged results.
…lts are not repeated in subsequent paged results.
There was a problem hiding this comment.
Pull request overview
Adds a deterministic tie-break sort to contact search pagination to prevent duplicate/missing records across pages (VB-6479), and introduces integration coverage + supporting test data to validate correct paging + ordering.
Changes:
- Append
contactIdas a final sort field when searching contacts to ensure stable pagination. - Update unit test expectations for native-query sort conversion to include
contact_id. - Add a new integration test suite (with supporting Flyway test migration data) to verify paging returns all expected results for multiple sort directions/fields.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/main/kotlin/uk/gov/justice/digital/hmpps/personalrelationships/service/ContactSearchService.kt | Forces a stable sort by appending contactId to the requested sort before paging. |
| src/test/kotlin/uk/gov/justice/digital/hmpps/personalrelationships/service/ContactSearchServiceTest.kt | Updates assertions so native sort conversion includes the added contact_id tiebreaker. |
| src/test/kotlin/uk/gov/justice/digital/hmpps/personalrelationships/integration/resource/SearchContactsPaginationIntegrationTest.kt | New integration tests validating 5-page retrieval and ordering for lastName/dateOfBirth asc/desc. |
| src/main/resources/migrations/test/V2026.03.11.1__VB_6479_example_contacts_data.sql | Adds 50 deterministic contacts (IDs 2001–2050) used by the new pagination integration tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
src/main/resources/migrations/test/V2026.03.11.1__VB_6479_example_contacts_data.sql
Outdated
Show resolved
Hide resolved
.../hmpps/personalrelationships/integration/resource/SearchContactsPaginationIntegrationTest.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
...in/kotlin/uk/gov/justice/digital/hmpps/personalrelationships/service/ContactSearchService.kt
Outdated
Show resolved
Hide resolved
.../hmpps/personalrelationships/integration/resource/SearchContactsPaginationIntegrationTest.kt
Outdated
Show resolved
Hide resolved
src/main/resources/migrations/test/V2026.03.11.1__VB_6479_example_contacts_data.sql
Outdated
Show resolved
Hide resolved
…hips/service/ContactSearchService.kt Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…hips/integration/resource/SearchContactsPaginationIntegrationTest.kt Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ple_contacts_data.sql Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
.../hmpps/personalrelationships/integration/resource/SearchContactsPaginationIntegrationTest.kt
Outdated
Show resolved
Hide resolved
...in/kotlin/uk/gov/justice/digital/hmpps/personalrelationships/service/ContactSearchService.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
No description provided.