Skip to content

Commit

Permalink
Add Bed ID to CAS1 Out of Service Bed Summary
Browse files Browse the repository at this point in the history
  • Loading branch information
davidatkinsuk committed Jan 22, 2025
1 parent 4f97d55 commit 9f0af64
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,7 @@ interface Cas1SpaceBookingRepository : JpaRepository<Cas1SpaceBookingEntity, UUI
ELSE
oa.name
END as personName,
CASE
WHEN
apa.id IS NOT NULL THEN apa.release_type
ELSE
null
END as releaseType,
apa.release_type as releaseType,
(
SELECT STRING_AGG (characteristics.property_name, ',')
FROM cas1_space_bookings_criteria sbc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Cas1OutOfServiceBedSummaryTransformer(

fun toCas1OutOfServiceBedSummary(jpa: Cas1OutOfServiceBedEntity) = Cas1OutOfServiceBedSummary(
id = jpa.id,
bedId = jpa.bed.id,
roomName = jpa.bed.room.name,
startDate = jpa.startDate,
endDate = jpa.endDate,
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/static/cas1-schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,9 @@ components:
id:
type: string
format: uuid
bedId:
type: string
format: uuid
roomName:
type: string
startDate:
Expand All @@ -851,6 +854,7 @@ components:
$ref: '#/components/schemas/Cas1SpaceCharacteristic'
required:
- id
- bedId
- startDate
- endDate
- reason
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/static/codegen/built-cas1-api-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6923,6 +6923,9 @@ components:
id:
type: string
format: uuid
bedId:
type: string
format: uuid
roomName:
type: string
startDate:
Expand All @@ -6939,6 +6942,7 @@ components:
$ref: '#/components/schemas/Cas1SpaceCharacteristic'
required:
- id
- bedId
- startDate
- endDate
- reason
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class Cas1OutOfServiceBedSummaryTransformerTest {
val result = transformer.toCas1OutOfServiceBedSummary(outOfServiceBed)

assertThat(result.id).isEqualTo(outOfServiceBed.id)
assertThat(result.bedId).isEqualTo(bed.id)
assertThat(result.roomName).isEqualTo(bed.room.name)
assertThat(result.startDate).isEqualTo(outOfServiceBed.startDate)
assertThat(result.endDate).isEqualTo(outOfServiceBed.endDate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class Cas1PremisesDayTransformerTest {
val outOfServiceBeds = listOf(
Cas1OutOfServiceBedSummary(
id = UUID.randomUUID(),
bedId = UUID.randomUUID(),
startDate = LocalDate.now().minusDays(5),
endDate = LocalDate.now().plusDays(5),
reason = Cas1OutOfServiceBedReason(UUID.randomUUID(), "reason", true),
Expand Down

0 comments on commit 9f0af64

Please sign in to comment.