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
Copy file name to clipboardexpand all lines: src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/controllers/v1/person/PersonController.kt
val response = getPersonsService.execute(firstName, lastName, pncNumber, searchWithinAliases)
49
+
if (dateOfBirth !=null&&!isValidISODateFormat(dateOfBirth)) {
50
+
throwValidationException("Invalid date format. Please use yyyy-MM-dd.")
51
+
}
52
+
53
+
val response = getPersonsService.execute(firstName, lastName, pncNumber, dateOfBirth, searchWithinAliases)
47
54
48
-
auditService.createEvent("SEARCH_PERSON", "Person searched with first name: $firstName, last name: $lastName, search within aliases: $searchWithinAliases, pnc number: $pncNumber")
55
+
auditService.createEvent("SEARCH_PERSON", "Person searched with first name: $firstName, last name: $lastName, search within aliases: $searchWithinAliases, pnc number: $pncNumber, date of birth: $dateOfBirth")
49
56
return response.data.paginateWith(page, perPage)
50
57
}
51
58
@@ -79,4 +86,13 @@ class PersonController(
79
86
auditService.createEvent("GET_PERSON_IMAGE", "Image with id: $hmppsId has been retrieved")
Copy file name to clipboardexpand all lines: src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/gateways/PrisonerOffenderSearchGateway.kt
+2-2
Original file line number
Diff line number
Diff line change
@@ -18,10 +18,10 @@ class PrisonerOffenderSearchGateway(@Value("\${services.prisoner-offender-search
mapOf("firstName" to firstName, "lastName" to lastName, "includeAliases" to searchWithinAliases, "prisonerIdentifier" to hmppsId)
24
+
mapOf("firstName" to firstName, "lastName" to lastName, "includeAliases" to searchWithinAliases, "dateOfBirth" to dateOfBirth, "prisonerIdentifier" to hmppsId)
25
25
.filterValues { it !=null }
26
26
27
27
val result = webClient.request<POSGlobalSearch>(HttpMethod.POST, "/global-search?size=$maxNumberOfResults", authenticationHeader(), UpstreamApi.PRISONER_OFFENDER_SEARCH, requestBody)
Copy file name to clipboardexpand all lines: src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/gateways/ProbationOffenderSearchGateway.kt
+2-2
Original file line number
Diff line number
Diff line change
@@ -63,8 +63,8 @@ class ProbationOffenderSearchGateway(@Value("\${services.probation-offender-sear
val requestBody =mapOf("firstName" to firstName, "surname" to surname, "pncNumber" to pncNumber, "dateOfBirth" to dateOfBirth, "includeAliases" to searchWithinAliases)
68
68
.filterValues { it !=null }
69
69
70
70
val result = webClient.requestList<Offender>(HttpMethod.POST, "/search", authenticationHeader(), UpstreamApi.PROBATION_OFFENDER_SEARCH, requestBody)
Copy file name to clipboardexpand all lines: src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/controllers/v1/person/PersonControllerTest.kt
+27-59
Original file line number
Diff line number
Diff line change
@@ -48,13 +48,14 @@ internal class PersonControllerTest(
48
48
val basePath = "/v1/persons"
49
49
val firstName = "Barry"
50
50
val lastName = "Allen"
51
+
val dateOfBirth = "2023-03-01"
51
52
val mockMvc = IntegrationAPIMockMvc(springMockMvc)
verify(auditService, times(1)).createEvent("SEARCH_PERSON", "Person searched with first name: $firstName, last name: $lastName, search within aliases: false, pnc number: $pncNumber")
verify(auditService, times(1)).createEvent("SEARCH_PERSON", "Person searched with first name: $firstName, last name: $lastName, search within aliases: false, pnc number: $pncNumber, date of birth: $dateOfBirth")
0 commit comments