diff --git a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/api/model/PersonSummary.kt b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/api/model/PersonSummary.kt index 58c7011fb3..3754266f79 100644 --- a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/api/model/PersonSummary.kt +++ b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/api/model/PersonSummary.kt @@ -5,6 +5,7 @@ import java.time.LocalDate data class PersonSummary( val name: Name, val crn: String, + val offenderId: Long, val pnc: String?, val dateOfBirth: LocalDate ) diff --git a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/personalDetails/entity/Address.kt b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/personalDetails/entity/Address.kt index b586b2405d..7e58fcac98 100644 --- a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/personalDetails/entity/Address.kt +++ b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/personalDetails/entity/Address.kt @@ -25,7 +25,7 @@ class PersonAddress( @ManyToOne @JoinColumn(name = "address_type_id") - val type: ReferenceData, + val type: ReferenceData?, @Column(name = "building_name") val buildingName: String?, diff --git a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/PersonalDetailsService.kt b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/PersonalDetailsService.kt index 44de9ed56e..4575eea7de 100644 --- a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/PersonalDetailsService.kt +++ b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/PersonalDetailsService.kt @@ -185,7 +185,13 @@ fun PersonalContactEntity.toContact() = PersonalContact( ) fun Person.toSummary() = - PersonSummary(name = Name(forename, secondName, surname), pnc = pnc, dateOfBirth = dateOfBirth, crn = crn) + PersonSummary( + name = Name(forename, secondName, surname), + pnc = pnc, + dateOfBirth = dateOfBirth, + crn = crn, + offenderId = id + ) fun Person.name() = Name(forename, listOfNotNull(secondName, thirdName).joinToString(" "), surname) fun PersonAddress.toAddress() = Address.from( @@ -201,7 +207,7 @@ fun PersonAddress.toAddress() = Address.from( verified = typeVerified, lastUpdated = lastUpdated, status = status.description, - type = type.description, + type = type?.description, telephoneNumber = telephoneNumber, lastUpdatedBy = Name(forename = lastUpdatedUser.forename, surname = lastUpdatedUser.surname) @@ -220,4 +226,5 @@ fun ContactAddress.toAddress() = uk.gov.justice.digital.hmpps.api.model.personal ) fun PersonDocument.toDocument() = Document(id = alfrescoId, name = name, lastUpdated = lastUpdated) -fun PersonSummaryEntity.toPersonSummary() = PersonSummary(Name(forename, secondName, surname), crn, pnc, dateOfBirth) \ No newline at end of file +fun PersonSummaryEntity.toPersonSummary() = + PersonSummary(Name(forename, secondName, surname), crn, id, pnc, dateOfBirth) \ No newline at end of file diff --git a/projects/manage-supervision-and-delius/src/test/kotlin/uk/gov/justice/digital/hmpps/api/controller/PersonalDetailsControllerTest.kt b/projects/manage-supervision-and-delius/src/test/kotlin/uk/gov/justice/digital/hmpps/api/controller/PersonalDetailsControllerTest.kt index d7f34dd9d4..fcdd6f7f72 100644 --- a/projects/manage-supervision-and-delius/src/test/kotlin/uk/gov/justice/digital/hmpps/api/controller/PersonalDetailsControllerTest.kt +++ b/projects/manage-supervision-and-delius/src/test/kotlin/uk/gov/justice/digital/hmpps/api/controller/PersonalDetailsControllerTest.kt @@ -36,7 +36,7 @@ internal class PersonalDetailsControllerTest { personSummary = PersonSummary( Name(forename = "TestName", middleName = null, surname = "TestSurname"), pnc = "Test PNC", crn = "CRN", - dateOfBirth = LocalDate.now(), + dateOfBirth = LocalDate.now(), offenderId = 1L ) }