Skip to content

Commit

Permalink
Merge pull request #12557 from transcom/MAIN-B-18911-gun-safe-backend
Browse files Browse the repository at this point in the history
Main b 18911 gun safe backend
  • Loading branch information
JamesHawks224 authored May 10, 2024
2 parents 4dc205c + 1e64b65 commit 528d5ae
Show file tree
Hide file tree
Showing 28 changed files with 158 additions and 1 deletion.
2 changes: 2 additions & 0 deletions migrations/app/migrations_manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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.';
Original file line number Diff line number Diff line change
@@ -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;
28 changes: 28 additions & 0 deletions pkg/gen/ghcapi/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pkg/gen/ghcmessages/counseling_update_allowance_payload.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/gen/ghcmessages/entitlements.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pkg/gen/ghcmessages/update_allowance_payload.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions pkg/gen/primeapi/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/gen/primemessages/entitlements.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions pkg/gen/primev2api/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/gen/primev2messages/entitlements.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions pkg/gen/primev3api/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/gen/primev3messages/entitlements.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions pkg/gen/supportapi/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/gen/supportmessages/entitlement.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pkg/handlers/ghcapi/internal/payloads/model_to_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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),
}
}

Expand Down
1 change: 1 addition & 0 deletions pkg/handlers/primeapi/payloads/model_to_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions pkg/handlers/primeapiv2/payloads/model_to_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions pkg/models/ghc_entitlements.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
8 changes: 8 additions & 0 deletions pkg/services/order/order_updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down
3 changes: 3 additions & 0 deletions swagger-def/definitions/prime/Entitlements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ properties:
example: true
type: boolean
x-nullable: true
gunSafe:
type: boolean
example: false
nonTemporaryStorage:
example: false
type: boolean
Expand Down
11 changes: 11 additions & 0 deletions swagger-def/ghc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3917,6 +3917,9 @@ definitions:
example: true
type: boolean
x-nullable: true
gunSafe:
type: boolean
example: false
nonTemporaryStorage:
example: false
type: boolean
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions swagger-def/support.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,9 @@ definitions:
example: true
type: boolean
x-nullable: true
gunSafe:
type: boolean
example: false
nonTemporaryStorage:
example: false
type: boolean
Expand Down
Loading

0 comments on commit 528d5ae

Please sign in to comment.