Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update jsonInclude SentenceKeyDate #453

Merged
merged 3 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ data class LatestSentenceKeyDatesAndAdjustments(
val automaticRelease: SentenceKeyDate? = null,
val conditionalRelease: SentenceKeyDate? = null,
val dtoPostRecallRelease: SentenceKeyDate? = null,
val earlyTerm: SentenceKeyDate? = null,
val earlyTerm: SentenceKeyDateWithCalculatedDate? = null,
val homeDetentionCurfew: HomeDetentionCurfewDate? = null,
val lateTerm: SentenceKeyDate? = null,
val licenceExpiry: SentenceKeyDate? = null,
val midTerm: SentenceKeyDate? = null,
val lateTerm: SentenceKeyDateWithCalculatedDate? = null,
val licenceExpiry: SentenceKeyDateWithCalculatedDate? = null,
val midTerm: SentenceKeyDateWithCalculatedDate? = null,
val nonDto: NonDtoDate? = null,
val nonParole: SentenceKeyDate? = null,
val paroleEligibility: SentenceKeyDate? = null,
val paroleEligibility: SentenceKeyDateWithCalculatedDate? = null,
val postRecallRelease: SentenceKeyDate? = null,
val release: ReleaseDate? = null,
val sentence: SentenceDate? = null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps

import com.fasterxml.jackson.annotation.JsonInclude
import java.time.LocalDate

@JsonInclude(JsonInclude.Include.NON_NULL)
data class SentenceKeyDate(
val date: LocalDate? = null,
val overrideDate: LocalDate? = null,
val calculatedDate: LocalDate? = null,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps

import java.time.LocalDate

data class SentenceKeyDateWithCalculatedDate(
val date: LocalDate? = null,
val overrideDate: LocalDate? = null,
val calculatedDate: LocalDate? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ data class SentenceKeyDates(
val automaticRelease: SentenceKeyDate = SentenceKeyDate(),
val conditionalRelease: SentenceKeyDate = SentenceKeyDate(),
val dtoPostRecallRelease: SentenceKeyDate = SentenceKeyDate(),
val earlyTerm: SentenceKeyDate = SentenceKeyDate(),
val earlyTerm: SentenceKeyDateWithCalculatedDate = SentenceKeyDateWithCalculatedDate(),
val homeDetentionCurfew: HomeDetentionCurfewDate = HomeDetentionCurfewDate(),
val lateTerm: SentenceKeyDate = SentenceKeyDate(),
val licenceExpiry: SentenceKeyDate = SentenceKeyDate(),
val midTerm: SentenceKeyDate = SentenceKeyDate(),
val lateTerm: SentenceKeyDateWithCalculatedDate = SentenceKeyDateWithCalculatedDate(),
val licenceExpiry: SentenceKeyDateWithCalculatedDate = SentenceKeyDateWithCalculatedDate(),
val midTerm: SentenceKeyDateWithCalculatedDate = SentenceKeyDateWithCalculatedDate(),
val nonDto: NonDtoDate = NonDtoDate(),
val nonParole: SentenceKeyDate = SentenceKeyDate(),
val paroleEligibility: SentenceKeyDate = SentenceKeyDate(),
val paroleEligibility: SentenceKeyDateWithCalculatedDate = SentenceKeyDateWithCalculatedDate(),
val postRecallRelease: SentenceKeyDate = SentenceKeyDate(),
val release: ReleaseDate = ReleaseDate(),
val sentence: SentenceDate = SentenceDate(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.NonDtoDate
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.ReleaseDate
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.SentenceDate
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.SentenceKeyDate
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.SentenceKeyDateWithCalculatedDate
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.SentenceKeyDates
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.TopupSupervision
import java.time.LocalDate
Expand Down Expand Up @@ -64,7 +65,7 @@ data class NomisSentenceKeyDates(
automaticRelease = SentenceKeyDate(date = this.automaticReleaseDate, overrideDate = this.automaticReleaseOverrideDate),
conditionalRelease = SentenceKeyDate(date = this.conditionalReleaseDate, overrideDate = this.conditionalReleaseOverrideDate),
dtoPostRecallRelease = SentenceKeyDate(date = this.dtoPostRecallReleaseDate, overrideDate = this.dtoPostRecallReleaseDateOverride),
earlyTerm = SentenceKeyDate(date = this.earlyTermDate, overrideDate = this.etdOverrideDate, calculatedDate = this.etdCalculatedDate),
earlyTerm = SentenceKeyDateWithCalculatedDate(date = this.earlyTermDate, overrideDate = this.etdOverrideDate, calculatedDate = this.etdCalculatedDate),
homeDetentionCurfew =
HomeDetentionCurfewDate(
actualDate = this.homeDetentionCurfewActualDate,
Expand All @@ -73,18 +74,18 @@ data class NomisSentenceKeyDates(
eligibilityOverrideDate = this.homeDetentionCurfewEligibilityOverrideDate,
endDate = this.homeDetentionCurfewEndDate,
),
lateTerm = SentenceKeyDate(date = this.lateTermDate, overrideDate = this.ltdOverrideDate, calculatedDate = this.ltdCalculatedDate),
lateTerm = SentenceKeyDateWithCalculatedDate(date = this.lateTermDate, overrideDate = this.ltdOverrideDate, calculatedDate = this.ltdCalculatedDate),
licenceExpiry =
SentenceKeyDate(
SentenceKeyDateWithCalculatedDate(
date = this.licenceExpiryDate,
overrideDate = this.licenceExpiryOverrideDate,
calculatedDate = this.licenceExpiryCalculatedDate,
),
midTerm = SentenceKeyDate(date = this.midTermDate, overrideDate = this.mtdOverrideDate, calculatedDate = this.mtdCalculatedDate),
midTerm = SentenceKeyDateWithCalculatedDate(date = this.midTermDate, overrideDate = this.mtdOverrideDate, calculatedDate = this.mtdCalculatedDate),
nonDto = NonDtoDate(date = this.nonDtoReleaseDate, releaseDateType = this.nonDtoReleaseDateType),
nonParole = SentenceKeyDate(date = this.nonParoleDate, overrideDate = this.nonParoleOverrideDate),
paroleEligibility =
SentenceKeyDate(
SentenceKeyDateWithCalculatedDate(
date = this.paroleEligibilityDate,
overrideDate = this.paroleEligibilityOverrideDate,
calculatedDate = this.paroleEligibilityCalculatedDate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.Response
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.SentenceAdjustment
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.SentenceDate
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.SentenceKeyDate
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.SentenceKeyDateWithCalculatedDate
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.TopupSupervision
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.UpstreamApi
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.UpstreamApiError
Expand Down Expand Up @@ -73,7 +74,7 @@ internal class LatestSentenceKeyDatesAndAdjustmentsControllerTest(
conditionalRelease = SentenceKeyDate(date = LocalDate.parse("2023-05-01"), overrideDate = LocalDate.parse("2023-05-01")),
dtoPostRecallRelease = SentenceKeyDate(date = LocalDate.parse("2024-01-02"), overrideDate = LocalDate.parse("2024-01-02")),
earlyTerm =
SentenceKeyDate(
SentenceKeyDateWithCalculatedDate(
date = LocalDate.parse("2021-11-02"),
overrideDate = LocalDate.parse("2021-11-02"),
calculatedDate = LocalDate.parse("2021-11-02"),
Expand All @@ -87,27 +88,27 @@ internal class LatestSentenceKeyDatesAndAdjustmentsControllerTest(
endDate = LocalDate.parse("2022-04-01"),
),
lateTerm =
SentenceKeyDate(
SentenceKeyDateWithCalculatedDate(
date = LocalDate.parse("2022-01-01"),
overrideDate = LocalDate.parse("2022-01-01"),
calculatedDate = LocalDate.parse("2022-01-01"),
),
licenceExpiry =
SentenceKeyDate(
SentenceKeyDateWithCalculatedDate(
date = LocalDate.parse("2025-02-01"),
overrideDate = LocalDate.parse("2025-02-01"),
calculatedDate = LocalDate.parse("2025-02-01"),
),
midTerm =
SentenceKeyDate(
SentenceKeyDateWithCalculatedDate(
date = LocalDate.parse("2024-02-01"),
overrideDate = LocalDate.parse("2024-02-01"),
calculatedDate = LocalDate.parse("2024-02-01"),
),
nonDto = NonDtoDate(date = LocalDate.parse("2024-02-01"), releaseDateType = "CRD"),
nonParole = SentenceKeyDate(date = LocalDate.parse("2026-11-02"), overrideDate = LocalDate.parse("2026-11-02")),
paroleEligibility =
SentenceKeyDate(
SentenceKeyDateWithCalculatedDate(
date = LocalDate.parse("2027-02-01"),
overrideDate = LocalDate.parse("2027-02-01"),
calculatedDate = LocalDate.parse("2027-02-01"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.Response
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.SentenceAdjustment
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.SentenceDate
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.SentenceKeyDate
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.SentenceKeyDateWithCalculatedDate
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.SentenceKeyDates
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.TopupSupervision
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.UpstreamApi
Expand Down Expand Up @@ -62,7 +63,7 @@ internal class GetLatestSentenceKeyDatesAndAdjustmentsForPersonServiceTest(
conditionalRelease = SentenceKeyDate(date = LocalDate.parse("2023-12-02"), overrideDate = LocalDate.parse("2023-12-02")),
dtoPostRecallRelease = SentenceKeyDate(date = LocalDate.parse("2024-01-02"), overrideDate = LocalDate.parse("2024-01-02")),
earlyTerm =
SentenceKeyDate(
SentenceKeyDateWithCalculatedDate(
date = LocalDate.parse("2021-11-02"),
overrideDate = LocalDate.parse("2021-11-02"),
calculatedDate = LocalDate.parse("2021-11-02"),
Expand All @@ -76,27 +77,27 @@ internal class GetLatestSentenceKeyDatesAndAdjustmentsForPersonServiceTest(
endDate = LocalDate.parse("2022-04-01"),
),
lateTerm =
SentenceKeyDate(
SentenceKeyDateWithCalculatedDate(
date = LocalDate.parse("2022-01-01"),
overrideDate = LocalDate.parse("2022-01-01"),
calculatedDate = LocalDate.parse("2022-01-01"),
),
licenceExpiry =
SentenceKeyDate(
SentenceKeyDateWithCalculatedDate(
date = LocalDate.parse("2025-02-01"),
overrideDate = LocalDate.parse("2025-02-01"),
calculatedDate = LocalDate.parse("2025-02-01"),
),
midTerm =
SentenceKeyDate(
SentenceKeyDateWithCalculatedDate(
date = LocalDate.parse("2024-02-01"),
overrideDate = LocalDate.parse("2024-02-01"),
calculatedDate = LocalDate.parse("2024-02-01"),
),
nonDto = NonDtoDate(date = LocalDate.parse("2024-02-01"), releaseDateType = "CRD"),
nonParole = SentenceKeyDate(date = LocalDate.parse("2026-11-02"), overrideDate = LocalDate.parse("2026-11-02")),
paroleEligibility =
SentenceKeyDate(
SentenceKeyDateWithCalculatedDate(
date = LocalDate.parse("2027-02-01"),
overrideDate = LocalDate.parse("2027-02-01"),
calculatedDate = LocalDate.parse("2027-02-01"),
Expand Down
Loading