You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HMAI-270 - Get contacts controller + new PaginatedResponse changes (#703)
* Get prisoner contacts controller and tests
* Contacts model updates and int tests for get prisoner contacts
* New factory methods on PaginatedResponse
* Fix build errors
* Use interface extension method
* Fix unit tests
* Add pagination examples
---------
Co-authored-by: wcdkj <will.clark@digital.justice.gov.uk>
Copy file name to clipboardexpand all lines: src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/controllers/v1/person/PersonController.kt
@Parameter(description ="The HMPPS ID of the prisoner") @PathVariable hmppsId:String,
177
+
@Parameter(description ="The page number (starting from 1)", schema =Schema(minimum ="1")) @RequestParam(required =false, defaultValue ="1", name ="page") page:Int,
178
+
@Parameter(description ="The maximum number of results for a page", schema =Schema(minimum ="1")) @RequestParam(required =false, defaultValue ="10", name ="perPage") perPage:Int,
179
+
@RequestAttribute filters:ConsumerFilters?,
180
+
): PaginatedResponse<PrisonerContact> {
181
+
val response = getPrisonerContactsService.execute(hmppsId, page, perPage, filters)
182
+
183
+
if (response.hasError(UpstreamApiError.Type.ENTITY_NOT_FOUND)) {
184
+
throwEntityNotFoundException("Could not find person with id: $hmppsId")
185
+
}
186
+
187
+
if (response.hasError(UpstreamApiError.Type.BAD_REQUEST)) {
Copy file name to clipboardexpand all lines: src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/models/personalRelationships/PRPaginatedPrisonerContacts.kt
+6-6
Original file line number
Diff line number
Diff line change
@@ -19,12 +19,12 @@ data class PRPaginatedPrisonerContacts(
Copy file name to clipboardexpand all lines: src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/x4022-personal-relationships.json
0 commit comments