From 406649db862600c6336d47e2ebd304ba068a30ed Mon Sep 17 00:00:00 2001 From: davidatkinsuk Date: Fri, 3 Jan 2025 12:18:06 +0000 Subject: [PATCH] Removed Cas1SpaceSearchResult.spacesAvailable This was always populated as an empty list, and not used on the UI --- .../cas1/Cas1SpaceSearchResultsTransformer.kt | 1 - src/main/resources/static/cas1-schemas.yml | 20 +++---------------- .../static/codegen/built-cas1-api-spec.yml | 20 +++---------------- .../integration/cas1/Cas1SpaceSearchTest.kt | 3 +-- .../Cas1SpaceSearchResultsTransformerTest.kt | 2 -- 5 files changed, 7 insertions(+), 39 deletions(-) diff --git a/src/main/kotlin/uk/gov/justice/digital/hmpps/approvedpremisesapi/transformer/cas1/Cas1SpaceSearchResultsTransformer.kt b/src/main/kotlin/uk/gov/justice/digital/hmpps/approvedpremisesapi/transformer/cas1/Cas1SpaceSearchResultsTransformer.kt index fa61145468..3110c05712 100644 --- a/src/main/kotlin/uk/gov/justice/digital/hmpps/approvedpremisesapi/transformer/cas1/Cas1SpaceSearchResultsTransformer.kt +++ b/src/main/kotlin/uk/gov/justice/digital/hmpps/approvedpremisesapi/transformer/cas1/Cas1SpaceSearchResultsTransformer.kt @@ -47,7 +47,6 @@ class Cas1SpaceSearchResultsTransformer { }, ), distanceInMiles = candidatePremises.distanceInMiles.toBigDecimal(), - spacesAvailable = listOf(), ) }, ) diff --git a/src/main/resources/static/cas1-schemas.yml b/src/main/resources/static/cas1-schemas.yml index 60e8bb00d2..dcedd6e733 100644 --- a/src/main/resources/static/cas1-schemas.yml +++ b/src/main/resources/static/cas1-schemas.yml @@ -318,23 +318,9 @@ components: distanceInMiles: type: number example: 2.1 - spacesAvailable: - type: array - deprecated: true - description: "This is not populated and will be removed in the future" - items: - $ref: '#/components/schemas/Cas1SpaceAvailability' - Cas1SpaceAvailability: - type: object - deprecated: true - properties: - spaceCharacteristics: - type: array - items: - $ref: '#/components/schemas/Cas1SpaceCharacteristic' - durationInDays: - type: integer - example: 77 + required: + - premises + - distanceInMiles Cas1SpaceCategory: type: string example: arson diff --git a/src/main/resources/static/codegen/built-cas1-api-spec.yml b/src/main/resources/static/codegen/built-cas1-api-spec.yml index ffcbd51cdb..f84b307479 100644 --- a/src/main/resources/static/codegen/built-cas1-api-spec.yml +++ b/src/main/resources/static/codegen/built-cas1-api-spec.yml @@ -6365,23 +6365,9 @@ components: distanceInMiles: type: number example: 2.1 - spacesAvailable: - type: array - deprecated: true - description: "This is not populated and will be removed in the future" - items: - $ref: '#/components/schemas/Cas1SpaceAvailability' - Cas1SpaceAvailability: - type: object - deprecated: true - properties: - spaceCharacteristics: - type: array - items: - $ref: '#/components/schemas/Cas1SpaceCharacteristic' - durationInDays: - type: integer - example: 77 + required: + - premises + - distanceInMiles Cas1SpaceCategory: type: string example: arson diff --git a/src/test/kotlin/uk/gov/justice/digital/hmpps/approvedpremisesapi/integration/cas1/Cas1SpaceSearchTest.kt b/src/test/kotlin/uk/gov/justice/digital/hmpps/approvedpremisesapi/integration/cas1/Cas1SpaceSearchTest.kt index bc97837e0c..7265530c8f 100644 --- a/src/test/kotlin/uk/gov/justice/digital/hmpps/approvedpremisesapi/integration/cas1/Cas1SpaceSearchTest.kt +++ b/src/test/kotlin/uk/gov/justice/digital/hmpps/approvedpremisesapi/integration/cas1/Cas1SpaceSearchTest.kt @@ -364,10 +364,9 @@ class Cas1SpaceSearchTest : InitialiseDatabasePerClassTestBase() { expectedApType: ApType = ApType.normal, expectedCharacteristics: List? = null, ) { - assertThat(actual.spacesAvailable).isEmpty() assertThat(actual.distanceInMiles).isGreaterThan(0f.toBigDecimal()) assertThat(actual.premises).isNotNull - val premises = actual.premises!! + val premises = actual.premises assertThat(premises.id).isEqualTo(expected.id) assertThat(premises.apType).isEqualTo(expectedApType) assertThat(premises.name).isEqualTo(expected.name) diff --git a/src/test/kotlin/uk/gov/justice/digital/hmpps/approvedpremisesapi/unit/transformer/cas1/Cas1SpaceSearchResultsTransformerTest.kt b/src/test/kotlin/uk/gov/justice/digital/hmpps/approvedpremisesapi/unit/transformer/cas1/Cas1SpaceSearchResultsTransformerTest.kt index 2a66808aeb..21756c23f9 100644 --- a/src/test/kotlin/uk/gov/justice/digital/hmpps/approvedpremisesapi/unit/transformer/cas1/Cas1SpaceSearchResultsTransformerTest.kt +++ b/src/test/kotlin/uk/gov/justice/digital/hmpps/approvedpremisesapi/unit/transformer/cas1/Cas1SpaceSearchResultsTransformerTest.kt @@ -89,7 +89,6 @@ class Cas1SpaceSearchResultsTransformerTest { assertThat(premises1.premisesCharacteristics).isEmpty() assertThat(premises1.characteristics).isEmpty() assertThat(actual.results[0].distanceInMiles).isEqualTo(BigDecimal.valueOf(1.0)) - assertThat(actual.results[0].spacesAvailable).isEmpty() val premises2 = actual.results[1].premises assertThat(premises2).isNotNull @@ -107,6 +106,5 @@ class Cas1SpaceSearchResultsTransformerTest { assertThat(premises2.premisesCharacteristics).isEmpty() assertThat(premises2.characteristics).isEmpty() assertThat(actual.results[1].distanceInMiles).isEqualTo(BigDecimal.valueOf(2.0)) - assertThat(actual.results[1].spacesAvailable).isEmpty() } }