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/AlertsController.kt
@Parameter(description ="A URL-encoded HMPPS identifier", example ="2008%2F0545166T") @PathVariable encodedHmppsId:String,
92
+
@Parameter(description ="The page number (starting from 1)", schema =Schema(minimum ="1")) @RequestParam(required =false, defaultValue ="1", name ="page") page:Int,
93
+
@Parameter(description ="The maximum number of results for a page", schema =Schema(minimum ="1")) @RequestParam(required =false, defaultValue ="10", name ="perPage") perPage:Int,
94
+
): PaginatedResponse<Alert> {
95
+
val hmppsId = encodedHmppsId.decodeUrlCharacters()
96
+
val response = getAlertsForPersonService.getAlertsForPnd(hmppsId)
97
+
98
+
if (response.hasError(UpstreamApiError.Type.ENTITY_NOT_FOUND)) {
99
+
throwEntityNotFoundException("Could not find person with id: $hmppsId")
100
+
}
101
+
auditService.createEvent("GET_PERSON_ALERTS_PND", mapOf("hmppsId" to hmppsId))
Copy file name to clipboardexpand all lines: src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/controllers/v1/person/AlertsControllerTest.kt
+2-2
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ internal class AlertsControllerTest(
39
39
val hmppsId = "9999/11111A"
40
40
val encodedHmppsId = URLEncoder.encode(hmppsId, StandardCharsets.UTF_8)
41
41
val path = "/v1/persons/$encodedHmppsId/alerts"
42
-
val pndPath = "/v1/persons/$encodedHmppsId/alerts/pnd"
42
+
val pndPath = "/v1/pnd/persons/$encodedHmppsId/alerts"
43
43
val mockMvc = IntegrationAPIMockMvc(springMockMvc)
44
44
45
45
describe("GET $path") {
@@ -250,7 +250,7 @@ internal class AlertsControllerTest(
0 commit comments