Skip to content

Commit

Permalink
PI-2204 correct column name in approved_premises_preferred, to fix fa… (
Browse files Browse the repository at this point in the history
#3807)

PI-2204 correct column name in approved_premises_preferred, to fix failed deployment of pod

Signed-off-by: Amardeep Chimber <[email protected]>
  • Loading branch information
achimber-moj authored May 17, 2024
1 parent 740e603 commit eee3939
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ internal class MessagingIntegrationTest {
residenceRepository.findByReferralId(ref.id)?.also(residenceRepository::delete)

preferredResidenceRepository.save(PreferredResidence(0, ref.id))
assertTrue(preferredResidenceRepository.existsByApprovedPremisesResidenceId(ref.id))
assertTrue(preferredResidenceRepository.existsByApprovedPremisesReferralId(ref.id))

channelManager.getChannel(queueName).publishAndWait(event)

Expand Down Expand Up @@ -477,6 +477,6 @@ internal class MessagingIntegrationTest {
}
assertNull(referral)

assertFalse(preferredResidenceRepository.existsByApprovedPremisesResidenceId(ref.id))
assertFalse(preferredResidenceRepository.existsByApprovedPremisesReferralId(ref.id))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ class PreferredResidence(
@Column(name = "approved_premises_preferred_id")
val id: Long = 0,

val approvedPremisesResidenceId: Long
val approvedPremisesReferralId: Long
)

interface PreferredResidenceRepository : JpaRepository<PreferredResidence, Long> {
fun existsByApprovedPremisesResidenceId(approvedPremisesResidenceId: Long): Boolean
fun existsByApprovedPremisesReferralId(approvedPremisesReferralId: Long): Boolean

fun deleteByApprovedPremisesResidenceId(approvedPremisesResidenceId: Long)
fun deleteByApprovedPremisesReferralId(approvedPremisesReferralId: Long)
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ class ReferralService(
val person = personRepository.getByCrn(crn)
val externalReference = Nsi.EXT_REF_BOOKING_PREFIX + details.bookingId
val referral = findReferral(person, externalReference)?.also {
if (preferredResidenceRepository.existsByApprovedPremisesResidenceId(it.id)) {
preferredResidenceRepository.deleteByApprovedPremisesResidenceId(it.id)
if (preferredResidenceRepository.existsByApprovedPremisesReferralId(it.id)) {
preferredResidenceRepository.deleteByApprovedPremisesReferralId(it.id)
}

val residence = residenceRepository.findByReferralId(it.id)
Expand Down

0 comments on commit eee3939

Please sign in to comment.