diff --git a/migrations/app/migrations_manifest.txt b/migrations/app/migrations_manifest.txt index 037a6f6ffd0..b5e3a0876dc 100644 --- a/migrations/app/migrations_manifest.txt +++ b/migrations/app/migrations_manifest.txt @@ -919,7 +919,9 @@ 20240402155228_updateLongBeachGbloc.up.sql 20240402192009_add_shipment_locator_and_shipment_seq_num.up.sql 20240403172437_backfill_counties_again.up.sql +20240404152441_add_gun_safe_to_entitlements.up.sql 20240405190435_add_safety_privilege.up.sql 20240411201158_add_application_parameter_and_validation_code_table.up.sql +20240412201837_edit_gun_safe_entitlement_not_null.up.sql 20240416145256_update_safety_privilege_label.up.sql 20240503123556_add_diversion_reason_to_mto_shipments.up.sql diff --git a/migrations/app/schema/20240404152441_add_gun_safe_to_entitlements.up.sql b/migrations/app/schema/20240404152441_add_gun_safe_to_entitlements.up.sql new file mode 100644 index 00000000000..5991b3695f8 --- /dev/null +++ b/migrations/app/schema/20240404152441_add_gun_safe_to_entitlements.up.sql @@ -0,0 +1,7 @@ +-- Adds new column to entitlements table +-- allows customer to move a gun safe with their move. +ALTER TABLE entitlements +ADD COLUMN IF NOT EXISTS gun_safe BOOLEAN DEFAULT FALSE; + +-- Comments on new column +COMMENT ON COLUMN entitlements.gun_safe IS 'True if customer is entitled to move a gun safe up to 500 lbs without it being charged against their authorized weight allowance.'; \ No newline at end of file diff --git a/migrations/app/schema/20240412201837_edit_gun_safe_entitlement_not_null.up.sql b/migrations/app/schema/20240412201837_edit_gun_safe_entitlement_not_null.up.sql new file mode 100644 index 00000000000..fe9748b2ee6 --- /dev/null +++ b/migrations/app/schema/20240412201837_edit_gun_safe_entitlement_not_null.up.sql @@ -0,0 +1,5 @@ +-- COALESCE makes sure that any currently NULL gun_safe values are converted to false before setting to NOT NULL. +ALTER TABLE entitlements +ALTER COLUMN gun_safe TYPE boolean USING (COALESCE(gun_safe, false)), +ALTER COLUMN gun_safe SET DEFAULT false, +ALTER COLUMN gun_safe SET NOT NULL; diff --git a/pkg/gen/ghcapi/embedded_spec.go b/pkg/gen/ghcapi/embedded_spec.go index 99078688826..53dab5e936d 100644 --- a/pkg/gen/ghcapi/embedded_spec.go +++ b/pkg/gen/ghcapi/embedded_spec.go @@ -5387,6 +5387,11 @@ func init() { "grade": { "$ref": "#/definitions/Grade" }, + "gunSafe": { + "description": "True if user is entitled to move a gun safe (up to 500 lbs) as part of their move without it being charged against their weight allowance.", + "type": "boolean", + "x-nullable": true + }, "organizationalClothingAndIndividualEquipment": { "description": "only for Army", "type": "boolean", @@ -6282,6 +6287,10 @@ func init() { "eTag": { "type": "string" }, + "gunSafe": { + "type": "boolean", + "example": false + }, "id": { "type": "string", "format": "uuid", @@ -10425,6 +10434,11 @@ func init() { "grade": { "$ref": "#/definitions/Grade" }, + "gunSafe": { + "description": "True if user is entitled to move a gun safe (up to 500 lbs) as part of their move without it being charged against their weight allowance.", + "type": "boolean", + "x-nullable": true + }, "organizationalClothingAndIndividualEquipment": { "description": "only for Army", "type": "boolean", @@ -18108,6 +18122,11 @@ func init() { "grade": { "$ref": "#/definitions/Grade" }, + "gunSafe": { + "description": "True if user is entitled to move a gun safe (up to 500 lbs) as part of their move without it being charged against their weight allowance.", + "type": "boolean", + "x-nullable": true + }, "organizationalClothingAndIndividualEquipment": { "description": "only for Army", "type": "boolean", @@ -19007,6 +19026,10 @@ func init() { "eTag": { "type": "string" }, + "gunSafe": { + "type": "boolean", + "example": false + }, "id": { "type": "string", "format": "uuid", @@ -23204,6 +23227,11 @@ func init() { "grade": { "$ref": "#/definitions/Grade" }, + "gunSafe": { + "description": "True if user is entitled to move a gun safe (up to 500 lbs) as part of their move without it being charged against their weight allowance.", + "type": "boolean", + "x-nullable": true + }, "organizationalClothingAndIndividualEquipment": { "description": "only for Army", "type": "boolean", diff --git a/pkg/gen/ghcmessages/counseling_update_allowance_payload.go b/pkg/gen/ghcmessages/counseling_update_allowance_payload.go index 1ede0d87960..8aff2d86426 100644 --- a/pkg/gen/ghcmessages/counseling_update_allowance_payload.go +++ b/pkg/gen/ghcmessages/counseling_update_allowance_payload.go @@ -28,6 +28,9 @@ type CounselingUpdateAllowancePayload struct { // grade Grade *Grade `json:"grade,omitempty"` + // True if user is entitled to move a gun safe (up to 500 lbs) as part of their move without it being charged against their weight allowance. + GunSafe *bool `json:"gunSafe,omitempty"` + // only for Army OrganizationalClothingAndIndividualEquipment *bool `json:"organizationalClothingAndIndividualEquipment,omitempty"` diff --git a/pkg/gen/ghcmessages/entitlements.go b/pkg/gen/ghcmessages/entitlements.go index 2c0f5d3f0b5..371451ad198 100644 --- a/pkg/gen/ghcmessages/entitlements.go +++ b/pkg/gen/ghcmessages/entitlements.go @@ -30,6 +30,10 @@ type Entitlements struct { // e tag ETag string `json:"eTag,omitempty"` + // gun safe + // Example: false + GunSafe bool `json:"gunSafe,omitempty"` + // id // Example: 571008b1-b0de-454d-b843-d71be9f02c04 // Format: uuid diff --git a/pkg/gen/ghcmessages/update_allowance_payload.go b/pkg/gen/ghcmessages/update_allowance_payload.go index d57b8145528..aeb83c7caaa 100644 --- a/pkg/gen/ghcmessages/update_allowance_payload.go +++ b/pkg/gen/ghcmessages/update_allowance_payload.go @@ -28,6 +28,9 @@ type UpdateAllowancePayload struct { // grade Grade *Grade `json:"grade,omitempty"` + // True if user is entitled to move a gun safe (up to 500 lbs) as part of their move without it being charged against their weight allowance. + GunSafe *bool `json:"gunSafe,omitempty"` + // only for Army OrganizationalClothingAndIndividualEquipment *bool `json:"organizationalClothingAndIndividualEquipment,omitempty"` diff --git a/pkg/gen/primeapi/embedded_spec.go b/pkg/gen/primeapi/embedded_spec.go index 79a609acbdd..ec3831bb8c5 100644 --- a/pkg/gen/primeapi/embedded_spec.go +++ b/pkg/gen/primeapi/embedded_spec.go @@ -2019,6 +2019,10 @@ func init() { "type": "string", "readOnly": true }, + "gunSafe": { + "type": "boolean", + "example": false + }, "id": { "type": "string", "format": "uuid", @@ -7160,6 +7164,10 @@ func init() { "type": "string", "readOnly": true }, + "gunSafe": { + "type": "boolean", + "example": false + }, "id": { "type": "string", "format": "uuid", diff --git a/pkg/gen/primemessages/entitlements.go b/pkg/gen/primemessages/entitlements.go index f291a7842ee..7c498cd20a0 100644 --- a/pkg/gen/primemessages/entitlements.go +++ b/pkg/gen/primemessages/entitlements.go @@ -31,6 +31,10 @@ type Entitlements struct { // Read Only: true ETag string `json:"eTag,omitempty"` + // gun safe + // Example: false + GunSafe bool `json:"gunSafe,omitempty"` + // id // Example: 571008b1-b0de-454d-b843-d71be9f02c04 // Format: uuid diff --git a/pkg/gen/primev2api/embedded_spec.go b/pkg/gen/primev2api/embedded_spec.go index 8207095018b..be3a40fc45a 100644 --- a/pkg/gen/primev2api/embedded_spec.go +++ b/pkg/gen/primev2api/embedded_spec.go @@ -868,6 +868,10 @@ func init() { "type": "string", "readOnly": true }, + "gunSafe": { + "type": "boolean", + "example": false + }, "id": { "type": "string", "format": "uuid", @@ -4350,6 +4354,10 @@ func init() { "type": "string", "readOnly": true }, + "gunSafe": { + "type": "boolean", + "example": false + }, "id": { "type": "string", "format": "uuid", diff --git a/pkg/gen/primev2messages/entitlements.go b/pkg/gen/primev2messages/entitlements.go index d16cf31733a..f4390a92a35 100644 --- a/pkg/gen/primev2messages/entitlements.go +++ b/pkg/gen/primev2messages/entitlements.go @@ -31,6 +31,10 @@ type Entitlements struct { // Read Only: true ETag string `json:"eTag,omitempty"` + // gun safe + // Example: false + GunSafe bool `json:"gunSafe,omitempty"` + // id // Example: 571008b1-b0de-454d-b843-d71be9f02c04 // Format: uuid diff --git a/pkg/gen/primev3api/embedded_spec.go b/pkg/gen/primev3api/embedded_spec.go index 3b3a281dfce..7a42de8d8b0 100644 --- a/pkg/gen/primev3api/embedded_spec.go +++ b/pkg/gen/primev3api/embedded_spec.go @@ -871,6 +871,10 @@ func init() { "type": "string", "readOnly": true }, + "gunSafe": { + "type": "boolean", + "example": false + }, "id": { "type": "string", "format": "uuid", @@ -4332,6 +4336,10 @@ func init() { "type": "string", "readOnly": true }, + "gunSafe": { + "type": "boolean", + "example": false + }, "id": { "type": "string", "format": "uuid", diff --git a/pkg/gen/primev3messages/entitlements.go b/pkg/gen/primev3messages/entitlements.go index bcef1357f49..84abf8674a0 100644 --- a/pkg/gen/primev3messages/entitlements.go +++ b/pkg/gen/primev3messages/entitlements.go @@ -31,6 +31,10 @@ type Entitlements struct { // Read Only: true ETag string `json:"eTag,omitempty"` + // gun safe + // Example: false + GunSafe bool `json:"gunSafe,omitempty"` + // id // Example: 571008b1-b0de-454d-b843-d71be9f02c04 // Format: uuid diff --git a/pkg/gen/supportapi/embedded_spec.go b/pkg/gen/supportapi/embedded_spec.go index 03e375bf5f1..cbd38050953 100644 --- a/pkg/gen/supportapi/embedded_spec.go +++ b/pkg/gen/supportapi/embedded_spec.go @@ -1117,6 +1117,10 @@ func init() { "type": "string", "readOnly": true }, + "gunSafe": { + "type": "boolean", + "example": false + }, "id": { "type": "string", "format": "uuid", @@ -3922,6 +3926,10 @@ func init() { "type": "string", "readOnly": true }, + "gunSafe": { + "type": "boolean", + "example": false + }, "id": { "type": "string", "format": "uuid", diff --git a/pkg/gen/supportmessages/entitlement.go b/pkg/gen/supportmessages/entitlement.go index 0f3ce158808..ead88e4d83f 100644 --- a/pkg/gen/supportmessages/entitlement.go +++ b/pkg/gen/supportmessages/entitlement.go @@ -31,6 +31,10 @@ type Entitlement struct { // Read Only: true ETag string `json:"eTag,omitempty"` + // gun safe + // Example: false + GunSafe bool `json:"gunSafe,omitempty"` + // id // Example: 571008b1-b0de-454d-b843-d71be9f02c04 // Format: uuid diff --git a/pkg/handlers/ghcapi/internal/payloads/model_to_payload.go b/pkg/handlers/ghcapi/internal/payloads/model_to_payload.go index 7e4a8c78548..3063ff6e1d4 100644 --- a/pkg/handlers/ghcapi/internal/payloads/model_to_payload.go +++ b/pkg/handlers/ghcapi/internal/payloads/model_to_payload.go @@ -616,6 +616,7 @@ func Entitlement(entitlement *models.Entitlement) *ghcmessages.Entitlements { totalDependents = int64(*entitlement.TotalDependents) } requiredMedicalEquipmentWeight := int64(entitlement.RequiredMedicalEquipmentWeight) + gunSafe := entitlement.GunSafe return &ghcmessages.Entitlements{ ID: strfmt.UUID(entitlement.ID.String()), AuthorizedWeight: authorizedWeight, @@ -629,7 +630,8 @@ func Entitlement(entitlement *models.Entitlement) *ghcmessages.Entitlements { TotalWeight: totalWeight, RequiredMedicalEquipmentWeight: requiredMedicalEquipmentWeight, OrganizationalClothingAndIndividualEquipment: entitlement.OrganizationalClothingAndIndividualEquipment, - ETag: etag.GenerateEtag(entitlement.UpdatedAt), + GunSafe: gunSafe, + ETag: etag.GenerateEtag(entitlement.UpdatedAt), } } diff --git a/pkg/handlers/primeapi/payloads/model_to_payload.go b/pkg/handlers/primeapi/payloads/model_to_payload.go index eec80d38d0f..368a601b43e 100644 --- a/pkg/handlers/primeapi/payloads/model_to_payload.go +++ b/pkg/handlers/primeapi/payloads/model_to_payload.go @@ -200,6 +200,7 @@ func Entitlement(entitlement *models.Entitlement) *primemessages.Entitlements { ID: strfmt.UUID(entitlement.ID.String()), AuthorizedWeight: authorizedWeight, DependentsAuthorized: entitlement.DependentsAuthorized, + GunSafe: entitlement.GunSafe, NonTemporaryStorage: entitlement.NonTemporaryStorage, PrivatelyOwnedVehicle: entitlement.PrivatelyOwnedVehicle, ProGearWeight: int64(entitlement.ProGearWeight), diff --git a/pkg/handlers/primeapiv2/payloads/model_to_payload.go b/pkg/handlers/primeapiv2/payloads/model_to_payload.go index 5094e036a8c..1bd650a2e04 100644 --- a/pkg/handlers/primeapiv2/payloads/model_to_payload.go +++ b/pkg/handlers/primeapiv2/payloads/model_to_payload.go @@ -147,6 +147,7 @@ func Entitlement(entitlement *models.Entitlement) *primev2messages.Entitlements ID: strfmt.UUID(entitlement.ID.String()), AuthorizedWeight: authorizedWeight, DependentsAuthorized: entitlement.DependentsAuthorized, + GunSafe: entitlement.GunSafe, NonTemporaryStorage: entitlement.NonTemporaryStorage, PrivatelyOwnedVehicle: entitlement.PrivatelyOwnedVehicle, ProGearWeight: int64(entitlement.ProGearWeight), diff --git a/pkg/models/ghc_entitlements.go b/pkg/models/ghc_entitlements.go index 337e94776af..86e1f9d3c18 100644 --- a/pkg/models/ghc_entitlements.go +++ b/pkg/models/ghc_entitlements.go @@ -22,6 +22,7 @@ type Entitlement struct { DBAuthorizedWeight *int `db:"authorized_weight"` WeightAllotted *WeightAllotment `db:"-"` StorageInTransit *int `db:"storage_in_transit"` + GunSafe bool `db:"gun_safe"` RequiredMedicalEquipmentWeight int `db:"required_medical_equipment_weight"` OrganizationalClothingAndIndividualEquipment bool `db:"organizational_clothing_and_individual_equipment"` ProGearWeight int `db:"pro_gear_weight"` diff --git a/pkg/services/order/order_updater.go b/pkg/services/order/order_updater.go index 8f42fec6ca0..9c7ed24badf 100644 --- a/pkg/services/order/order_updater.go +++ b/pkg/services/order/order_updater.go @@ -426,6 +426,10 @@ func allowanceFromTOOPayload(existingOrder models.Order, payload ghcmessages.Upd order.Entitlement.StorageInTransit = &newSITAllowance } + if payload.GunSafe != nil { + order.Entitlement.GunSafe = *payload.GunSafe + } + return order } @@ -478,6 +482,10 @@ func allowanceFromCounselingPayload(existingOrder models.Order, payload ghcmessa order.Entitlement.StorageInTransit = &newSITAllowance } + if payload.GunSafe != nil { + order.Entitlement.GunSafe = *payload.GunSafe + } + return order } diff --git a/swagger-def/definitions/prime/Entitlements.yaml b/swagger-def/definitions/prime/Entitlements.yaml index 95696e99866..3f5bc398d06 100644 --- a/swagger-def/definitions/prime/Entitlements.yaml +++ b/swagger-def/definitions/prime/Entitlements.yaml @@ -13,6 +13,9 @@ properties: example: true type: boolean x-nullable: true + gunSafe: + type: boolean + example: false nonTemporaryStorage: example: false type: boolean diff --git a/swagger-def/ghc.yaml b/swagger-def/ghc.yaml index 02e83a85ffb..2749f283ade 100644 --- a/swagger-def/ghc.yaml +++ b/swagger-def/ghc.yaml @@ -3917,6 +3917,9 @@ definitions: example: true type: boolean x-nullable: true + gunSafe: + type: boolean + example: false nonTemporaryStorage: example: false type: boolean @@ -4666,6 +4669,10 @@ definitions: description: the number of storage in transit days that the customer is entitled to for a given shipment on their move type: integer minimum: 0 + gunSafe: + description: True if user is entitled to move a gun safe (up to 500 lbs) as part of their move without it being charged against their weight allowance. + type: boolean + x-nullable: true UpdateBillableWeightPayload: type: object properties: @@ -4735,6 +4742,10 @@ definitions: description: the number of storage in transit days that the customer is entitled to for a given shipment on their move type: integer minimum: 0 + gunSafe: + description: True if user is entitled to move a gun safe (up to 500 lbs) as part of their move without it being charged against their weight allowance. + type: boolean + x-nullable: true MoveTaskOrder: description: The Move (MoveTaskOrder) properties: diff --git a/swagger-def/support.yaml b/swagger-def/support.yaml index 9a41c97def5..cef3568f54a 100644 --- a/swagger-def/support.yaml +++ b/swagger-def/support.yaml @@ -863,6 +863,9 @@ definitions: example: true type: boolean x-nullable: true + gunSafe: + type: boolean + example: false nonTemporaryStorage: example: false type: boolean diff --git a/swagger/ghc.yaml b/swagger/ghc.yaml index a6aff3cd9d4..6a699b9fcd9 100644 --- a/swagger/ghc.yaml +++ b/swagger/ghc.yaml @@ -4062,6 +4062,9 @@ definitions: example: true type: boolean x-nullable: true + gunSafe: + type: boolean + example: false nonTemporaryStorage: example: false type: boolean @@ -4837,6 +4840,12 @@ definitions: for a given shipment on their move type: integer minimum: 0 + gunSafe: + description: >- + True if user is entitled to move a gun safe (up to 500 lbs) as part of + their move without it being charged against their weight allowance. + type: boolean + x-nullable: true UpdateBillableWeightPayload: type: object properties: @@ -4908,6 +4917,12 @@ definitions: for a given shipment on their move type: integer minimum: 0 + gunSafe: + description: >- + True if user is entitled to move a gun safe (up to 500 lbs) as part of + their move without it being charged against their weight allowance. + type: boolean + x-nullable: true MoveTaskOrder: description: The Move (MoveTaskOrder) properties: diff --git a/swagger/prime.yaml b/swagger/prime.yaml index 13d13698c17..c9c02593138 100644 --- a/swagger/prime.yaml +++ b/swagger/prime.yaml @@ -3122,6 +3122,9 @@ definitions: example: true type: boolean x-nullable: true + gunSafe: + type: boolean + example: false nonTemporaryStorage: example: false type: boolean diff --git a/swagger/prime_v2.yaml b/swagger/prime_v2.yaml index a7d8969b308..ade6acb211a 100644 --- a/swagger/prime_v2.yaml +++ b/swagger/prime_v2.yaml @@ -1516,6 +1516,9 @@ definitions: example: true type: boolean x-nullable: true + gunSafe: + type: boolean + example: false nonTemporaryStorage: example: false type: boolean diff --git a/swagger/prime_v3.yaml b/swagger/prime_v3.yaml index 690093621b8..ddb65523502 100644 --- a/swagger/prime_v3.yaml +++ b/swagger/prime_v3.yaml @@ -1462,6 +1462,9 @@ definitions: example: true type: boolean x-nullable: true + gunSafe: + type: boolean + example: false nonTemporaryStorage: example: false type: boolean diff --git a/swagger/support.yaml b/swagger/support.yaml index 0cdf68ed4a1..c281fddc312 100644 --- a/swagger/support.yaml +++ b/swagger/support.yaml @@ -936,6 +936,9 @@ definitions: example: true type: boolean x-nullable: true + gunSafe: + type: boolean + example: false nonTemporaryStorage: example: false type: boolean