Skip to content

Commit

Permalink
Merge pull request #14418 from transcom/MAIN-B-21905-rename-nts-shipm…
Browse files Browse the repository at this point in the history
…ent-type

MAIN - B-21905 - Rename NTS shipment type
  • Loading branch information
WeatherfordAaron authored Jan 9, 2025
2 parents 5083c0f + 5366519 commit 60288aa
Show file tree
Hide file tree
Showing 88 changed files with 239 additions and 217 deletions.
1 change: 1 addition & 0 deletions migrations/app/migrations_manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,7 @@
20241204155919_update_ordering_proc.up.sql
20241204210208_retroactive_update_of_ppm_max_and_estimated_incentives_prd.up.sql
20241210143143_redefine_mto_shipment_audit_table.up.sql
20241216170325_update_nts_enum_name.up.sql
20241216190428_update_get_zip_code_function_and_update_pricing_proc.up.sql
20241217163231_update_duty_locations_bad_zips.up.sql
20241217180136_add_AK_zips_to_zip3_distances.up.sql
Expand Down
25 changes: 25 additions & 0 deletions migrations/app/schema/20241216170325_update_nts_enum_name.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
-- Rename the existing enum value 'HHG_INTO_NTS_DOMESTIC' to 'HHG_INTO_NTS'
DO $$
BEGIN
IF EXISTS (
SELECT 1
FROM pg_type t
JOIN pg_enum e ON t.oid = e.enumtypid
WHERE t.typname = 'mto_shipment_type'
AND e.enumlabel = 'HHG_INTO_NTS_DOMESTIC'
) THEN
ALTER TYPE mto_shipment_type
RENAME VALUE 'HHG_INTO_NTS_DOMESTIC' TO 'HHG_INTO_NTS';
END IF;
END $$;

-- Update column comments to include all current shipment types
COMMENT ON COLUMN mto_shipments.shipment_type IS 'The type of shipment. The list includes:
1. Personally procured move (PPM)
2. Household goods move (HHG)
3. Non-temporary storage (HHG_INTO_NTS)
4. Non-temporary storage-release (HHG_OUTOF_NTS_DOMESTIC)
5. Mobile home (MOBILE_HOME)
6. Boat haul away (BOAT_HAUL_AWAY)
7. Boat tow away (BOAT_TOW_AWAY)
8. Unaccompanied baggage (UNACCOMPANIED_BAGGAGE)';
6 changes: 3 additions & 3 deletions pkg/factory/mto_shipment_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ func buildMTOShipmentWithBuildType(db *pop.Connection, customs []Customization,
hasStorageFacilityCustom := findValidCustomization(customs, StorageFacility) != nil
buildStorageFacility :=
cMtoShipment.ShipmentType == models.MTOShipmentTypeHHGOutOfNTSDom ||
cMtoShipment.ShipmentType == models.MTOShipmentTypeHHGIntoNTSDom
cMtoShipment.ShipmentType == models.MTOShipmentTypeHHGIntoNTS
shipmentHasPickupDetails := cMtoShipment.ShipmentType != models.MTOShipmentTypeHHGOutOfNTSDom && cMtoShipment.ShipmentType != models.MTOShipmentTypePPM
shipmentHasDeliveryDetails := cMtoShipment.ShipmentType != models.MTOShipmentTypeHHGIntoNTSDom && cMtoShipment.ShipmentType != models.MTOShipmentTypePPM
shipmentHasDeliveryDetails := cMtoShipment.ShipmentType != models.MTOShipmentTypeHHGIntoNTS && cMtoShipment.ShipmentType != models.MTOShipmentTypePPM
addPrimeActualWeight := true
switch buildType {
case mtoShipmentNTS:
defaultShipmentType = models.MTOShipmentTypeHHGIntoNTSDom
defaultShipmentType = models.MTOShipmentTypeHHGIntoNTS
defaultStatus = models.MTOShipmentStatusDraft
buildStorageFacility = hasStorageFacilityCustom
shipmentHasPickupDetails = true
Expand Down
4 changes: 2 additions & 2 deletions pkg/factory/mto_shipment_factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (suite *FactorySuite) TestBuildMTOShipment() {
ID: uuid.FromStringOrNil("acf7b357-5cad-40e2-baa7-dedc1d4cf04c"),
PrimeEstimatedWeight: &estimatedWeight,
PrimeActualWeight: &actualWeight,
ShipmentType: models.MTOShipmentTypeHHGIntoNTSDom,
ShipmentType: models.MTOShipmentTypeHHGIntoNTS,
ApprovedDate: models.TimePointer(time.Now()),
Status: models.MTOShipmentStatusApproved,
}
Expand Down Expand Up @@ -421,7 +421,7 @@ func (suite *FactorySuite) TestBuildMTOShipment() {
suite.Run("Successful creation of NTSShipment", func() {
ntsShipment := BuildNTSShipment(suite.DB(), nil, nil)

suite.Equal(models.MTOShipmentTypeHHGIntoNTSDom, ntsShipment.ShipmentType)
suite.Equal(models.MTOShipmentTypeHHGIntoNTS, ntsShipment.ShipmentType)
suite.False(ntsShipment.MoveTaskOrderID.IsNil())
suite.False(ntsShipment.MoveTaskOrder.ID.IsNil())

Expand Down
12 changes: 6 additions & 6 deletions pkg/gen/ghcapi/embedded_spec.go

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

6 changes: 3 additions & 3 deletions pkg/gen/ghcmessages/m_t_o_shipment_type.go

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

8 changes: 4 additions & 4 deletions pkg/gen/ghcmessages/re_service_item.go

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

8 changes: 4 additions & 4 deletions pkg/gen/internalapi/embedded_spec.go

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

6 changes: 3 additions & 3 deletions pkg/gen/internalmessages/m_t_o_shipment_type.go

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

12 changes: 6 additions & 6 deletions pkg/gen/primeapi/embedded_spec.go

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

8 changes: 4 additions & 4 deletions pkg/gen/primemessages/m_t_o_shipment_type.go

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

Loading

0 comments on commit 60288aa

Please sign in to comment.