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-96 Add Prison Filter to Prison Controller (#568)
* Added prison filter to prisoner query endpoint with unit tests
* Updated how we get our session attributes for filtering in prisoner-details query, additional tests in relevant layers
* Removing unused DI service from get prisoners service
* Fixing unit tests in balances controller
* Revised prisonId config check to reject queries from consumers that have an empty prison property
* Revised prison filter logic and rectified tests
Copy file name to clipboardexpand all lines: src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/controllers/v1/prison/PrisonController.kt
+2-1
Original file line number
Diff line number
Diff line change
@@ -94,6 +94,7 @@ class PrisonController(
94
94
@Parameter(description ="Whether to return results that match the search criteria within the aliases of a person.") @RequestParam(required =false, defaultValue ="false", name ="search_within_aliases") searchWithinAliases:Boolean,
95
95
@Parameter(description ="The page number (starting from 1)", schema =Schema(minimum ="1")) @RequestParam(required =false, defaultValue ="1", name ="page") page:Int,
96
96
@Parameter(description ="The maximum number of results for a page", schema =Schema(minimum ="1")) @RequestParam(required =false, defaultValue ="10", name ="perPage") perPage:Int,
97
+
@RequestAttribute filters:ConsumerFilters?,
97
98
): PaginatedResponse<Person?> {
98
99
if (firstName ==null&& lastName ==null&& dateOfBirth ==null) {
Copy file name to clipboardexpand all lines: src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/gateways/PrisonerOffenderSearchGateway.kt
+53-1
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,59 @@ class PrisonerOffenderSearchGateway(
Copy file name to clipboardexpand all lines: src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/controllers/v1/person/PersonControllerTest.kt
-1
Original file line number
Diff line number
Diff line change
@@ -325,7 +325,6 @@ internal class PersonControllerTest(
Copy file name to clipboardexpand all lines: src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/controllers/v1/prison/PrisonControllerTest.kt
@@ -245,7 +249,7 @@ internal class PrisonControllerTest(
245
249
),
246
250
),
247
251
)
248
-
val result = mockMvc.performAuthorised("$basePath/prisoners?first_name=$firstName&last_name=$lastName&date_of_birth=$dateOfBirth")
252
+
val result = mockMvc.performAuthorised("$basePath/prisoners?first_name=$firstName&last_name=$lastName&date_of_birth=$dateOfBirth&search_within_aliases=false")
0 commit comments