-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CDPS-1086: Dependency bumps and fixing subsequent issues #8
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Jackson update changed the way that it was handling Nullish... which meant that I now needed to |
||
val foodAllergies: 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") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ import java.time.ZonedDateTime | |
class FieldHistory( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
val fieldHistoryId: Long = -1, | ||
val fieldHistoryId: Long = 0, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JPA changed how it was handling unpersisted entities... suddenly you're not allowed to have a default value of |
||
|
||
// Allow this to mutate in order to handle merges | ||
var prisonerNumber: String, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenAPI changes also broke this, now having to check the format instead...