Skip to content

Commit d14596f

Browse files
Changed the return JSON structure
1 parent a3e09d4 commit d14596f

File tree

2 files changed

+37
-44
lines changed

2 files changed

+37
-44
lines changed

src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/controllers/v1/person/PersonController.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class PersonController(
6161
@GetMapping("{encodedHmppsId}")
6262
fun getPerson(
6363
@PathVariable encodedHmppsId: String,
64-
): Map<String, Map<String, Person?>> {
64+
): Map<String, Person?> {
6565
val hmppsId = encodedHmppsId.decodeUrlCharacters()
6666
val response = getPersonService.getCombinedDataForPerson(hmppsId)
6767

@@ -70,8 +70,7 @@ class PersonController(
7070
}
7171

7272
auditService.createEvent("GET_PERSON_DETAILS", mapOf("hmppsId" to hmppsId))
73-
val data = response.data.mapValues { it.value }
74-
return mapOf("data" to data)
73+
return response.data
7574
}
7675

7776
@GetMapping("{encodedHmppsId}/images")

src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/controllers/v1/person/PersonControllerTest.kt

+35-41
Original file line numberDiff line numberDiff line change
@@ -317,48 +317,42 @@ internal class PersonControllerTest(
317317

318318
result.response.contentAsString.shouldBe(
319319
"""
320-
{
321-
"data":{
322-
"probationOffenderSearch":{
323-
"firstName":"Sam",
324-
"lastName":"Smith",
325-
"middleName":null,
326-
"dateOfBirth":null,
327-
"gender":null,
328-
"ethnicity":null,
329-
"aliases":[
330-
331-
],
332-
"identifiers":{
333-
"nomisNumber":"1234ABC",
334-
"croNumber":null,
335-
"deliusCrn":null
336-
},
337-
"pncId":null,
338-
"hmppsId":null,
339-
"contactDetails":null
340-
},
341-
"prisonerOffenderSearch":{
342-
"firstName":"Kim",
343-
"lastName":"Kardashian",
344-
"middleName":null,
345-
"dateOfBirth":null,
346-
"gender":null,
347-
"ethnicity":null,
348-
"aliases":[
349-
350-
],
351-
"identifiers":{
352-
"nomisNumber":null,
353-
"croNumber":null,
354-
"deliusCrn":null
355-
},
356-
"pncId":null,
357-
"hmppsId":null,
358-
"contactDetails":null
359-
}
360-
}
320+
{
321+
"probationOffenderSearch":{
322+
"firstName":"Sam",
323+
"lastName":"Smith",
324+
"middleName":null,
325+
"dateOfBirth":null,
326+
"gender":null,
327+
"ethnicity":null,
328+
"aliases":[],
329+
"identifiers":{
330+
"nomisNumber":"1234ABC",
331+
"croNumber":null,
332+
"deliusCrn":null
333+
},
334+
"pncId":null,
335+
"hmppsId":null,
336+
"contactDetails":null
337+
},
338+
"prisonerOffenderSearch":{
339+
"firstName":"Kim",
340+
"lastName":"Kardashian",
341+
"middleName":null,
342+
"dateOfBirth":null,
343+
"gender":null,
344+
"ethnicity":null,
345+
"aliases":[],
346+
"identifiers":{
347+
"nomisNumber":null,
348+
"croNumber":null,
349+
"deliusCrn":null
350+
},
351+
"pncId":null,
352+
"hmppsId":null,
353+
"contactDetails":null
361354
}
355+
}
362356
""".removeWhitespaceAndNewlines(),
363357
)
364358
}

0 commit comments

Comments
 (0)