generated from ministryofjustice/hmpps-template-kotlin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CDPS-1086: Dependency bumps and fixing subsequent issues
- Loading branch information
1 parent
c6a4d19
commit 99cfb20
Showing
15 changed files
with
508 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 26 additions & 22 deletions
48
.../gov/justice/digital/hmpps/healthandmedication/dto/request/PrisonerHealthUpdateRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,47 @@ | ||
package uk.gov.justice.digital.hmpps.healthandmedication.dto.request | ||
|
||
import com.fasterxml.jackson.annotation.JsonAnySetter | ||
import com.fasterxml.jackson.annotation.JsonIgnore | ||
import com.fasterxml.jackson.annotation.JsonInclude | ||
import com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL | ||
import io.swagger.v3.oas.annotations.StringToClassMapItem | ||
import io.swagger.v3.oas.annotations.media.Schema | ||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED | ||
import uk.gov.justice.digital.hmpps.healthandmedication.annotation.NullishReferenceDataCodeList | ||
import uk.gov.justice.digital.hmpps.healthandmedication.utils.Nullish | ||
import uk.gov.justice.digital.hmpps.healthandmedication.utils.getAttributeAsNullish | ||
|
||
private abstract class StringList : List<String> | ||
|
||
@Schema( | ||
description = "Request object for updating a prisoner's health information. Can include one or multiple fields. " + | ||
"If an attribute is provided and set to 'null' it will be updated equal to 'null'. " + | ||
"If it is not provided it is not updated", | ||
"If an attribute is not provided it is not updated. Valid reference codes for `foodAllergies` can be retrieved by " + | ||
"querying `GET /reference-data/domains/FOOD_ALLERGY` and `GET /reference-data/domains/MEDICAL_DIET` for " + | ||
"`medicalDietaryRequirements`.", | ||
type = "object", | ||
properties = [ | ||
StringToClassMapItem(key = "foodAllergies", value = StringList::class), | ||
StringToClassMapItem(key = "medicalDietaryRequirements", value = StringList::class), | ||
], | ||
example = """ | ||
{ | ||
"foodAllergies": ["FOOD_ALLERGY_EGG", "FOOD_ALLERGY_MILK"], | ||
"medicalDietaryRequirements": ["MEDICAL_DIET_LOW_CHOLESTEROL"] | ||
} | ||
""", | ||
) | ||
@JsonInclude(NON_NULL) | ||
data class PrisonerHealthUpdateRequest( | ||
@Schema(hidden = true) | ||
@JsonAnySetter | ||
private val attributes: MutableMap<String, Any?> = mutableMapOf(), | ||
) { | ||
@Schema( | ||
description = "The food allergies the prisoner has. A list of `ReferenceDataCode`.`id`", | ||
type = "string[]", | ||
example = "[FOOD_ALLERGY_EGG, FOOD_ALLERGY_MILK]", | ||
requiredMode = NOT_REQUIRED, | ||
) | ||
@field:NullishReferenceDataCodeList( | ||
domains = ["FOOD_ALLERGY"], | ||
) | ||
val foodAllergies: Nullish<List<String>> = getAttributeAsNullish<List<String>>(attributes, "foodAllergies") | ||
@field:NullishReferenceDataCodeList(domains = ["FOOD_ALLERGY"]) | ||
@JsonIgnore | ||
val foodAllergieees: Nullish<List<String>> = | ||
getAttributeAsNullish<List<String>>(attributes, "foodAllergies") | ||
|
||
@Schema( | ||
description = "The medical dietary requirements the prisoner has. A list of `ReferenceDataCode`.`id`", | ||
type = "string[]", | ||
example = "[MEDICAL_DIET_LOW_FAT, FREE_FROM_EGG]", | ||
requiredMode = NOT_REQUIRED, | ||
) | ||
@field:NullishReferenceDataCodeList( | ||
domains = ["MEDICAL_DIET", "FREE_FROM"], | ||
) | ||
@field:NullishReferenceDataCodeList(domains = ["MEDICAL_DIET"]) | ||
@JsonIgnore | ||
val medicalDietaryRequirements: Nullish<List<String>> = | ||
getAttributeAsNullish<List<String>>(attributes, "medicalDietaryRequirements") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.