Skip to content

Commit 60adc35

Browse files
committed
CDPS-1071 Make some properties of religion update request optional
1 parent 83b343f commit 60adc35

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/personprotectercharacteristics/dto/request/ReligionV1RequestDto.kt

+4-8
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,20 @@ data class ReligionV1RequestDto(
1616
@Schema(
1717
description = "Reason for the religion change",
1818
example = "Religion has changed",
19-
required = false,
20-
nullable = false,
19+
nullable = true,
2120
)
22-
val reasonForChange: String,
21+
val reasonForChange: String?,
2322

2423
@Schema(
2524
description = "The date the religious belief is valid from",
26-
required = true,
27-
nullable = false,
25+
nullable = true,
2826
)
29-
val effectiveFromDate: LocalDate,
27+
val effectiveFromDate: LocalDate?,
3028

3129
@Schema(
3230
description = "Boolean indicating if the religious belief has been verified.",
3331
example = "false",
3432
defaultValue = "false",
35-
required = true,
36-
nullable = false,
3733
)
3834
val isVerified: Boolean,
3935
)

src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/personprotectercharacteristics/resource/PersonProtectedCharacteristicsV1ResourceIntTest.kt

+19
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@ class PersonProtectedCharacteristicsV1ResourceIntTest : IntegrationTestBase() {
5656
.exchange()
5757
.expectStatus().isNoContent
5858
}
59+
60+
@Test
61+
fun `can update a persons religion by prisoner number - minimal request example`() {
62+
webTestClient.put()
63+
.uri("v1/person-protected-characteristics/religion?prisonerNumber=$PRISONER_NUMBER")
64+
.contentType(MediaType.APPLICATION_JSON)
65+
.headers(setAuthorisation(roles = listOf(PersonProtectedCharacteristicsRoleConstants.PROTECTED_CHARACTERISTICS_READ_WRITE_ROLE)))
66+
.bodyValue(MINIMAL_RELIGION_REQUEST_DTO)
67+
.exchange()
68+
.expectStatus().isNoContent
69+
}
5970
}
6071

6172
@Nested
@@ -125,6 +136,14 @@ class PersonProtectedCharacteristicsV1ResourceIntTest : IntegrationTestBase() {
125136
false,
126137
)
127138

139+
val MINIMAL_RELIGION_REQUEST_DTO =
140+
ReligionV1RequestDto(
141+
"AGNO",
142+
null,
143+
null,
144+
false,
145+
)
146+
128147
const val TEST_DOMAIN = "RELIGION"
129148
}
130149
}

0 commit comments

Comments
 (0)