Skip to content
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

Int b 21668 stored procs for ordering service items #14230

Conversation

deandreJones
Copy link
Contributor

@deandreJones deandreJones commented Nov 19, 2024

B-21668

Summary

Testing CreateApprovedServiceItemsForShipment

  1. create a new move with one of the addressees going to or from an Alaska location
  2. grab the shipment id
  3. then go to db client or psql-dev and run CALL public.createapprovedserviceitemsforshipment(:shipment_id);
  4. go to mto_service_items table and see that
    these service items are added to the shipment
International Shipping & Linehaul
International POE Fuel Surcharge
International Origin SIT Fuel Surcharge
International Destination SIT Fuel Surcharge
International HHG pack
International HHG unpack

Testing CreateAccessorialServiceItemsForShipment

  1. run make db_dev_fresh or make db_dev_migrate to get the db changes into your db client
  2. in a new query window set up the call similar to this
DO $$
DECLARE
    service_items mto_service_item_type[];
BEGIN
    service_items := ARRAY[
        ROW(
            NULL, -- id
            NULL, -- move_id
            NULL, -- mto_shipment_id
            'f2739142-97d1-40f3-a8f4-6a9daf390806', -- re_service_id
            NOW(), -- created_at
            NOW(), -- updated_at
            'Storage reason', -- reason
            '12345', -- pickup_postal_code
            'Storage service description', -- description
            'SUBMITTED', -- status (valid value from public.service_item_status)
            NULL, -- rejection_reason
            NULL, -- approved_at
            NULL, -- rejected_at
            '54321', -- sit_postal_code
            '2024-01-15', -- sit_entry_date
            '2024-02-01', -- sit_departure_date
            'eb4275bf-7826-412d-a49a-84d923438e53', -- sit_destination_final_address_id
            'eb4275bf-7826-412d-a49a-84d923438e53', -- sit_origin_hhg_original_address_id
            'eb4275bf-7826-412d-a49a-84d923438e53', -- sit_origin_hhg_actual_address_id
            500, -- estimated_weight
            450, -- actual_weight
            'eb4275bf-7826-412d-a49a-84d923438e53', -- sit_destination_original_address_id
            '2024-01-20', -- sit_customer_contacted
            '2024-01-25', -- sit_requested_delivery
            FALSE, -- requested_approvals_requested_status
            TRUE, -- customer_expense
            'Storage fee covered by customer', -- customer_expense_reason
            120, -- sit_delivery_miles
            NULL, -- pricing_estimate
            TRUE, -- standalone_crate
            NULL, -- locked_price_cents
            'O', -- service_location
            null, -- poe_location
            null -- pod_location
        )::mto_service_item_type,
        ROW(
            NULL, -- id
            NULL, -- move_id
            NULL, -- mto_shipment_id
            'ae84d292-f885-4138-86e2-b451855ffbf2', -- re_service_id
            NOW(), -- created_at
            NOW(), -- updated_at
            'Delivery delay reason', -- reason
            '54321', -- pickup_postal_code
            'Delivery service description', -- description
            'APPROVED', -- status (valid value from public.service_item_status)
            NULL, -- rejection_reason
            NULL, -- approved_at
            NULL, -- rejected_at
            '12345', -- sit_postal_code
            '2024-03-01', -- sit_entry_date
            '2024-03-15', -- sit_departure_date
            'eb4275bf-7826-412d-a49a-84d923438e53', -- sit_destination_final_address_id
            'eb4275bf-7826-412d-a49a-84d923438e53', -- sit_origin_hhg_original_address_id
            'eb4275bf-7826-412d-a49a-84d923438e53', -- sit_origin_hhg_actual_address_id
            600, -- estimated_weight
            580, -- actual_weight
            'eb4275bf-7826-412d-a49a-84d923438e53', -- sit_destination_original_address_id
            '2024-03-05', -- sit_customer_contacted
            '2024-03-10', -- sit_requested_delivery
            TRUE, -- requested_approvals_requested_status
            FALSE, -- customer_expense
            NULL, -- customer_expense_reason
            150, -- sit_delivery_miles
            NULL, -- pricing_estimate
            FALSE, -- standalone_crate
            NULL, -- locked_price_cents
            'D', -- service_location
            null, -- poe_location
            null -- pod_location
        )::mto_service_item_type
    ];

3. then  Execute the procedure as below
    ```
CALL CreateAccessorialServiceItemsForShipment(
        ':shipmentId',
        service_items
    );
END $$;

Database

Any new migrations/schema changes:

  • Follows our guidelines for Zero-Downtime Deploys.
  • Have been communicated to #g-database.
  • Secure migrations have been tested following the instructions in our docs.

@deandreJones deandreJones changed the base branch from main to integrationTesting November 19, 2024 18:03
@deandreJones deandreJones marked this pull request as ready for review November 19, 2024 19:07
@deandreJones deandreJones requested a review from a team as a code owner November 19, 2024 19:07
Copy link
Contributor

@danieljordan-caci danieljordan-caci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a static review, but will review again when changes are made. Also got some questions.

@deandreJones deandreJones added Mountain Movers Movin' Mountains 1 Sprint at a time INTEGRATION Slated for Integration Testing labels Nov 20, 2024
Copy link
Contributor

@danieljordan-caci danieljordan-caci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot - one last thing. Everything is working pretty good now.

Can you add the mto_service_item_type to the mto_service_item model?

@@ -176,3 +176,131 @@ func FetchRelatedDestinationSITFuelCharge(tx *pop.Connection, mtoServiceItemID u
SELECT mto_shipment_id FROM mto_service_items WHERE id = ?)`, ReServiceCodeDDSFSC, mtoServiceItemID).First(&serviceItem)
return serviceItem, err
}

type MTOServiceItemType struct {
ID uuid.UUID `db_type:"id"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be db:id?

Copy link
Contributor

@danieljordan-caci danieljordan-caci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well alright then.

@deandreJones
Copy link
Contributor Author

@begrohmann need your eyes

@deandreJones deandreJones merged commit fb50268 into integrationTesting Nov 26, 2024
27 of 29 checks passed
@deandreJones deandreJones deleted the INT-B-21668-stored-procs-for-ordering-service-items branch November 26, 2024 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database INTEGRATION Slated for Integration Testing Mountain Movers Movin' Mountains 1 Sprint at a time
Development

Successfully merging this pull request may close these issues.

5 participants