Skip to content

Commit 772f8cf

Browse files
committed
CDPS-975: Allowing birth place to be set to null
1 parent d675191 commit 772f8cf

File tree

4 files changed

+54
-35
lines changed

4 files changed

+54
-35
lines changed

.github/workflows/pipeline.yml

+21-20
Original file line numberDiff line numberDiff line change
@@ -87,23 +87,24 @@ jobs:
8787
environment: 'development'
8888
app_version: '${{ needs.build.outputs.app_version }}'
8989

90-
# deploy_preprod:
91-
# name: Deploy to pre-production environment
92-
# needs:
93-
# - build
94-
# - deploy_dev
95-
# uses: ministryofjustice/hmpps-github-actions/.github/workflows/deploy_env.yml@v1 # WORKFLOW_VERSION
96-
# secrets: inherit
97-
# with:
98-
# environment: 'preprod'
99-
# app_version: '${{ needs.build.outputs.app_version }}'
100-
# deploy_prod:
101-
# name: Deploy to production environment
102-
# needs:
103-
# - build
104-
# - deploy_preprod
105-
# uses: ministryofjustice/hmpps-github-actions/.github/workflows/deploy_env.yml@v1 # WORKFLOW_VERSION
106-
# secrets: inherit
107-
# with:
108-
# environment: 'prod'
109-
# app_version: '${{ needs.build.outputs.app_version }}'
90+
deploy_preprod:
91+
name: Deploy to pre-production environment
92+
needs:
93+
- build
94+
- deploy_dev
95+
uses: ministryofjustice/hmpps-github-actions/.github/workflows/deploy_env.yml@v1 # WORKFLOW_VERSION
96+
secrets: inherit
97+
with:
98+
environment: 'preprod'
99+
app_version: '${{ needs.build.outputs.app_version }}'
100+
101+
deploy_prod:
102+
name: Deploy to production environment
103+
needs:
104+
- build
105+
- deploy_preprod
106+
uses: ministryofjustice/hmpps-github-actions/.github/workflows/deploy_env.yml@v1 # WORKFLOW_VERSION
107+
secrets: inherit
108+
with:
109+
environment: 'prod'
110+
app_version: '${{ needs.build.outputs.app_version }}'

src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/common/client/dto/UpdateBirthPlace.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import io.swagger.v3.oas.annotations.media.Schema
44

55
@Schema(description = "Update to prisoner birth place (city or town of birth)")
66
data class UpdateBirthPlace(
7-
@Schema(description = "Birth place (city or town of birth)", example = "SHEFFIELD")
8-
val birthPlace: String,
7+
@Schema(description = "Birth place (city or town of birth)", example = "SHEFFIELD", required = true, nullable = true)
8+
val birthPlace: String?,
99
)

src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/corepersonrecord/dto/request/CorePersonRecordV1UpdateRequestDto.kt

+7-10
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,12 @@ sealed class CorePersonRecordV1UpdateRequestDto {
3333
@Schema(description = "Core Person Record V1 birthplace update request")
3434
data class BirthplaceUpdateDto(
3535
@Schema(
36-
description = "The new value for the Birthplace",
36+
description = "The new value for the birthplace",
3737
example = "London",
3838
required = true,
39-
nullable = false,
39+
nullable = true ,
4040
)
41-
@field:NotNull()
42-
override val value: String,
41+
override val value: String?,
4342
) : CorePersonRecordV1UpdateRequestDto() {
4443
@Schema(
4544
type = "String",
@@ -57,11 +56,10 @@ data class DateOfBirthUpdateDto(
5756
description = "The new value for the date of birth field",
5857
example = "01/01/2000",
5958
required = true,
60-
nullable = false,
59+
nullable = true,
6160
)
62-
@field:NotNull()
6361
@field:DateTimeFormat(pattern = "dd/mm/yyyy")
64-
override val value: LocalDate,
62+
override val value: LocalDate?,
6563
) : CorePersonRecordV1UpdateRequestDto() {
6664
@Schema(
6765
type = "String",
@@ -79,10 +77,9 @@ data class CountryOfBirthUpdateDto(
7977
description = "The new value for the country of brith field",
8078
example = "UK",
8179
required = true,
82-
nullable = false,
80+
nullable = true,
8381
)
84-
@field:NotNull()
85-
override val value: String,
82+
override val value: String?,
8683
) : CorePersonRecordV1UpdateRequestDto() {
8784
@Schema(
8885
type = "String",

src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/corepersonrecord/resource/CorePersonRecordV1ResourceIntTest.kt

+24-3
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,21 @@ class CorePersonRecordV1ResourceIntTest : IntegrationTestBase() {
5050
inner class HappyPath {
5151

5252
@Test
53-
fun `can patch core person record by prisoner number`() {
53+
fun `can patch core person record birthplace by prisoner number`() {
5454
webTestClient.patch().uri("/v1/core-person-record?prisonerNumber=$PRISONER_NUMBER")
5555
.contentType(MediaType.APPLICATION_JSON)
5656
.headers(setAuthorisation(roles = listOf(CorePersonRecordRoleConstants.CORE_PERSON_RECORD_READ_WRITE_ROLE)))
57-
.bodyValue(VALID_PATCH_REQUEST_BODY)
57+
.bodyValue(BIRTHPLACE_PATCH_REQUEST_BODY)
58+
.exchange()
59+
.expectStatus().isNoContent
60+
}
61+
62+
@Test
63+
fun `patch core person record birthplace accepts null value`() {
64+
webTestClient.patch().uri("/v1/core-person-record?prisonerNumber=$PRISONER_NUMBER")
65+
.contentType(MediaType.APPLICATION_JSON)
66+
.headers(setAuthorisation(roles = listOf(CorePersonRecordRoleConstants.CORE_PERSON_RECORD_READ_WRITE_ROLE)))
67+
.bodyValue(NULL_BIRTHPLACE_PATCH_REQUEST_BODY)
5868
.exchange()
5969
.expectStatus().isNoContent
6070
}
@@ -163,7 +173,7 @@ class CorePersonRecordV1ResourceIntTest : IntegrationTestBase() {
163173

164174
private companion object {
165175

166-
val VALID_PATCH_REQUEST_BODY =
176+
val BIRTHPLACE_PATCH_REQUEST_BODY =
167177
// language=json
168178
"""
169179
{
@@ -172,6 +182,17 @@ class CorePersonRecordV1ResourceIntTest : IntegrationTestBase() {
172182
}
173183
""".trimIndent()
174184

185+
val NULL_BIRTHPLACE_PATCH_REQUEST_BODY =
186+
// language=json
187+
"""
188+
{
189+
"fieldName": "BIRTHPLACE",
190+
"value": null
191+
}
192+
""".trimIndent()
193+
194+
val VALID_PATCH_REQUEST_BODY = BIRTHPLACE_PATCH_REQUEST_BODY
195+
175196
val MULTIPART_FILE: MultipartFile = MockMultipartFile(
176197
"file",
177198
"filename.jpg",

0 commit comments

Comments
 (0)