diff --git a/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/AppointmentOutcomeIntegrationTest.kt b/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/AppointmentOutcomeIntegrationTest.kt index 47fedf817c..df3c6e4494 100644 --- a/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/AppointmentOutcomeIntegrationTest.kt +++ b/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/AppointmentOutcomeIntegrationTest.kt @@ -1,6 +1,5 @@ package uk.gov.justice.digital.hmpps -import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.equalTo import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertFalse @@ -18,14 +17,10 @@ import uk.gov.justice.digital.hmpps.api.model.appointment.CreateAppointment import uk.gov.justice.digital.hmpps.api.model.appointment.Outcome import uk.gov.justice.digital.hmpps.api.model.appointment.User import uk.gov.justice.digital.hmpps.data.generator.AppointmentGenerator.ATTENDED_COMPLIED -import uk.gov.justice.digital.hmpps.data.generator.ContactGenerator.DEFAULT_PROVIDER -import uk.gov.justice.digital.hmpps.data.generator.OffenderManagerGenerator.DEFAULT_LOCATION -import uk.gov.justice.digital.hmpps.data.generator.OffenderManagerGenerator.STAFF_1 import uk.gov.justice.digital.hmpps.data.generator.OffenderManagerGenerator.STAFF_USER_1 import uk.gov.justice.digital.hmpps.data.generator.OffenderManagerGenerator.TEAM import uk.gov.justice.digital.hmpps.data.generator.PersonGenerator import uk.gov.justice.digital.hmpps.integrations.delius.sentence.entity.AppointmentRepository -import uk.gov.justice.digital.hmpps.test.CustomMatchers.isCloseTo import uk.gov.justice.digital.hmpps.test.MockMvcExtensions.contentAsJson import uk.gov.justice.digital.hmpps.test.MockMvcExtensions.withJson import uk.gov.justice.digital.hmpps.test.MockMvcExtensions.withToken @@ -94,6 +89,7 @@ class AppointmentOutcomeIntegrationTest { val appointment = appointmentRepository.findById(response.appointments[0].id).get() assertEquals("Y", appointment.attended) assertEquals(request.notes, appointment.notes) + assertEquals(ATTENDED_COMPLIED.id, appointment.outcomeId) assertFalse(appointment.sensitive!!) diff --git a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/sentence/entity/Appointment.kt b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/sentence/entity/Appointment.kt index 1731f4fac7..74e1197344 100644 --- a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/sentence/entity/Appointment.kt +++ b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/sentence/entity/Appointment.kt @@ -83,9 +83,8 @@ class Appointment( @Column(name = "attended", columnDefinition = "char(1)") var attended: String? = null, - @ManyToOne - @JoinColumn(name = "contact_outcome_type_id") - val outcome: ContactOutcome? = null, + @Column(name = "contact_outcome_type_id") + var outcomeId: Long? = null, @Lob var notes: String? = null, diff --git a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/AppointmentOutcomeService.kt b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/AppointmentOutcomeService.kt index 823fc930ab..87d23ae913 100644 --- a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/AppointmentOutcomeService.kt +++ b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/AppointmentOutcomeService.kt @@ -21,6 +21,7 @@ class AppointmentOutcomeService( appointment.apply { attended = if (contactTypeOutcome.type.attendanceContact) "Y" else "N" notes = outcome.notes + outcomeId = contactTypeOutcome.outcome.id sensitive = outcome.sensitive }