Skip to content

Commit

Permalink
Merge branch 'main' into B-22779
Browse files Browse the repository at this point in the history
  • Loading branch information
r-mettler authored Mar 5, 2025
2 parents 6f1e7ca + 8bb93db commit 2888df7
Show file tree
Hide file tree
Showing 47 changed files with 552 additions and 91 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--B-22651 Maria Traskowsky Add ub_weight_restriction column to entitlements table
ALTER TABLE entitlements
ADD COLUMN IF NOT EXISTS ub_weight_restriction int;
COMMENT ON COLUMN entitlements.weight_restriction IS 'The weight restriction of the entitlement.';
COMMENT ON COLUMN entitlements.ub_weight_restriction IS 'The UB weight restriction of the entitlement.';
1 change: 1 addition & 0 deletions migrations/app/ddl_tables_manifest.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This is the tables migrations manifest.
# If a migration is not recorded here, then it will error.
# Naming convention: tbl_some_table.up.sql running <generate-ddl-migration some_table tables> will create this file.
20250221195354_tbl_alter_entitlements_B-22651.up.sql
20250224200700_tbl_ppm_shipments.up.sql
20250227211221_tbl_re_country_prn_divisions.up.sql
36 changes: 36 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.

4 changes: 4 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.

4 changes: 4 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.

12 changes: 12 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.

12 changes: 12 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.

12 changes: 12 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.

10 changes: 10 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.

11 changes: 8 additions & 3 deletions pkg/handlers/ghcapi/internal/payloads/model_to_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,10 @@ func Entitlement(entitlement *models.Entitlement) *ghcmessages.Entitlements {
if entitlement.WeightRestriction != nil {
weightRestriction = models.Int64Pointer(int64(*entitlement.WeightRestriction))
}
var ubWeightRestriction *int64
if entitlement.UBWeightRestriction != nil {
ubWeightRestriction = models.Int64Pointer(int64(*entitlement.UBWeightRestriction))
}

return &ghcmessages.Entitlements{
ID: strfmt.UUID(entitlement.ID.String()),
Expand All @@ -769,9 +773,10 @@ func Entitlement(entitlement *models.Entitlement) *ghcmessages.Entitlements {
AccompaniedTour: accompaniedTour,
UnaccompaniedBaggageAllowance: ubAllowance,
OrganizationalClothingAndIndividualEquipment: entitlement.OrganizationalClothingAndIndividualEquipment,
GunSafe: gunSafe,
WeightRestriction: weightRestriction,
ETag: etag.GenerateEtag(entitlement.UpdatedAt),
GunSafe: gunSafe,
WeightRestriction: weightRestriction,
UbWeightRestriction: ubWeightRestriction,
ETag: etag.GenerateEtag(entitlement.UpdatedAt),
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ func (suite *PayloadsSuite) TestEntitlement() {
authorizedWeight := 8000
ubAllowance := 300
weightRestriction := 1000
ubWeightRestriction := 1200

entitlement := &models.Entitlement{
ID: entitlementID,
Expand All @@ -687,6 +688,7 @@ func (suite *PayloadsSuite) TestEntitlement() {
UpdatedAt: time.Now(),
UBAllowance: &ubAllowance,
WeightRestriction: &weightRestriction,
UBWeightRestriction: &ubWeightRestriction,
}

returnedEntitlement := Entitlement(entitlement)
Expand All @@ -709,6 +711,7 @@ func (suite *PayloadsSuite) TestEntitlement() {
suite.Equal(dependentsUnderTwelve, int(*returnedEntitlement.DependentsUnderTwelve))
suite.Equal(dependentsTwelveAndOver, int(*returnedEntitlement.DependentsTwelveAndOver))
suite.Equal(weightRestriction, int(*returnedEntitlement.WeightRestriction))
suite.Equal(ubWeightRestriction, int(*returnedEntitlement.UbWeightRestriction))
}

func (suite *PayloadsSuite) TestCreateCustomer() {
Expand Down
2 changes: 2 additions & 0 deletions pkg/handlers/ghcapi/orders.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ func (h CreateOrderHandler) Handle(params orderop.CreateOrderParams) middleware.
}

var weightRestriction *int
var ubWeightRestriction *int

entitlement := models.Entitlement{
DependentsAuthorized: payload.HasDependents,
Expand All @@ -303,6 +304,7 @@ func (h CreateOrderHandler) Handle(params orderop.CreateOrderParams) middleware.
DependentsTwelveAndOver: dependentsTwelveAndOver,
UBAllowance: &weightAllotment.UnaccompaniedBaggageAllowance,
WeightRestriction: weightRestriction,
UBWeightRestriction: ubWeightRestriction,
}

if saveEntitlementErr := appCtx.DB().Save(&entitlement); saveEntitlementErr != nil {
Expand Down
15 changes: 10 additions & 5 deletions pkg/handlers/primeapi/payloads/model_to_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ func Entitlement(entitlement *models.Entitlement) *primemessages.Entitlements {
if entitlement.WeightRestriction != nil {
weightRestriction = int64(*entitlement.WeightRestriction)
}
var ubWeightRestriction int64
if entitlement.UBWeightRestriction != nil {
ubWeightRestriction = int64(*entitlement.UBWeightRestriction)
}
return &primemessages.Entitlements{
ID: strfmt.UUID(entitlement.ID.String()),
AuthorizedWeight: authorizedWeight,
Expand All @@ -278,11 +282,12 @@ func Entitlement(entitlement *models.Entitlement) *primemessages.Entitlements {
ProGearWeightSpouse: int64(entitlement.ProGearWeightSpouse),
RequiredMedicalEquipmentWeight: int64(entitlement.RequiredMedicalEquipmentWeight),
OrganizationalClothingAndIndividualEquipment: entitlement.OrganizationalClothingAndIndividualEquipment,
StorageInTransit: sit,
TotalDependents: totalDependents,
TotalWeight: totalWeight,
WeightRestriction: &weightRestriction,
ETag: etag.GenerateEtag(entitlement.UpdatedAt),
StorageInTransit: sit,
TotalDependents: totalDependents,
TotalWeight: totalWeight,
WeightRestriction: &weightRestriction,
UbWeightRestriction: &ubWeightRestriction,
ETag: etag.GenerateEtag(entitlement.UpdatedAt),
}
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/handlers/primeapi/payloads/model_to_payload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ func (suite *PayloadsSuite) TestEntitlement() {
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
WeightRestriction: models.IntPointer(1000),
UBWeightRestriction: models.IntPointer(1200),
}

// TotalWeight needs to read from the internal weightAllotment, in this case 7000 lbs w/o dependents and
Expand All @@ -375,6 +376,7 @@ func (suite *PayloadsSuite) TestEntitlement() {
suite.Equal(int64(1000), payload.ProGearWeight)
suite.Equal(int64(750), payload.ProGearWeightSpouse)
suite.Equal(int64(1000), *payload.WeightRestriction)
suite.Equal(int64(1200), *payload.UbWeightRestriction)
suite.NotEmpty(payload.ETag)
suite.Equal(etag.GenerateEtag(entitlement.UpdatedAt), payload.ETag)
})
Expand Down
Loading

0 comments on commit 2888df7

Please sign in to comment.