Skip to content

Commit

Permalink
Merge pull request #2617 from ministryofjustice/feature/aps-1498-spac…
Browse files Browse the repository at this point in the history
…e-booking-keyworker-assigned-at-is-nullable

APS-1498 - Spacebooking Key Worker Assigned at is always nullable
  • Loading branch information
davidatkinsuk authored Nov 29, 2024
2 parents 133c860 + 0acf697 commit b7cf594
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ data class Cas1SpaceBookingEntity(
val crn: String,
var keyWorkerStaffCode: String?,
var keyWorkerName: String?,
/**
* For data imported from delius this can be null even if a key worker staff code is set
*/
var keyWorkerAssignedAt: Instant?,
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "departure_reason_id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ class Cas1SpaceBookingTransformer(
val staffCode = keyWorkerStaffCode
val name = keyWorkerName
val assignedAt = keyWorkerAssignedAt
return if (staffCode != null && name != null && assignedAt != null) {
return if (staffCode != null && name != null) {
Cas1KeyWorkerAllocation(
keyWorker = StaffMember(
code = staffCode,
keyWorker = true,
name = name,
),
allocatedAt = assignedAt.toLocalDate(),
allocatedAt = assignedAt?.toLocalDate(),
)
} else {
null
Expand Down Expand Up @@ -162,7 +162,7 @@ class Cas1SpaceBookingTransformer(
tier = searchResult.tier,
keyWorkerAllocation = searchResult.keyWorkerStaffCode?.let { staffCode ->
Cas1KeyWorkerAllocation(
allocatedAt = searchResult.keyWorkerAssignedAt!!.toLocalDate(),
allocatedAt = searchResult.keyWorkerAssignedAt?.toLocalDate(),
keyWorker = StaffMember(
code = staffCode,
keyWorker = true,
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/static/cas1-schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,6 @@ components:
format: date
required:
- keyWorker
- allocatedAt
Cas1SpaceBookingDeparture:
type: object
properties:
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/static/codegen/built-cas1-api-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6551,7 +6551,6 @@ components:
format: date
required:
- keyWorker
- allocatedAt
Cas1SpaceBookingDeparture:
type: object
properties:
Expand Down

0 comments on commit b7cf594

Please sign in to comment.