Skip to content

Commit

Permalink
MAN-156 - update api and test
Browse files Browse the repository at this point in the history
  • Loading branch information
achimber-moj committed Nov 15, 2024
1 parent 3c3e9a4 commit b28658d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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!!)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit b28658d

Please sign in to comment.