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

MAIN B-21073 #13838

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open

MAIN B-21073 #13838

wants to merge 39 commits into from

Conversation

danieljordan-caci
Copy link
Contributor

@danieljordan-caci danieljordan-caci commented Oct 4, 2024

NOTE

I apologize in advance for this PR - it is quite a mess. There are three separate INT commits and I had to make commits only in INT due to some differences in payload/model conversions and then those were merged into main and had to handle dealing with those changes in here.

The first INT PR also held changes for the Go upgrade, so... just do your best. If all tests are passing then all should be well, but it might be worth testing this locally just to be sure we are good to go.

INT PR 1
INT PR 2
INT PR 3

Agility ticket

Summary

For the last twenty years I have been working on this BL item and its beautiful personality and quirks. After fighting a timeout issue likely due to so many concurrency issues happening when building addresses (and also adding countries to the db), I updated the db-truncate file to NOT clear the test db of re_countries data so we can retain that and avoid unnecessary inserts into the test database when building test data.

OKAY.

So the point of this BL item was to add a single source of truth for country information, which required a re_countries table with populated data.

In addition to adding that data, we had to then refactor how we are handling country data in the backend and adding the Country object to the struct and then making that data accessible to the UI.

This PR does the following:

  • adds migration file that adds the re_countries table and refactors the addresses table to use the id column of the re_countries in the new country_id column - drops the country column
  • updates relevant Go structs
  • adds/updates a buncha Eager/EagerPreload instances to use "Addresses.Country" now that the Country object holds the necessary data
  • updates the Address definition for Swagger to only be two characters (we will handle this later on when international rolls out)
  • defaults all created addresses to have a US country
  • updates all tests (roughly 3 million tests)

How to test

  1. Run make server_run and see the migrations run
  2. Check your database and you should now see a re_countries table, as well as the addresses table having a removed country column and added country_id column
  3. Open up the application and console log some addresses
  4. You should be able to see the Country object attached to the addresses
  5. Check any situation/process where Country is important

Agility ticket

Summary

This is adding a little cleanup + one missed oopsie of validating the country when the Prime attempts to create an address that contains a country code that is not supported.

Since we do not support international moves at this time, I added in a check that IF the Prime provides a country code that is not US, then we are going to send back an error message saying the country code they provided is not supported.

How to test

  1. Access MM as Prime Sim
  2. Find a move that you can create a shipment for
  3. Endpoint would be /prime/v3/mto-shipments
  4. Try to pass in an address that has a Country value of something that is NOT US - should get back a validation error
{
  "moveTaskOrderID": "0f21be2a-5045-4e90-8212-95a92de90056",
  "requestedPickupDate": "2024-10-12",
  "primeEstimatedWeight": 4000,
  "customerRemarks": "handle with care",
  "pickupAddress": {
    "streetAddress1": "123 OtherWorldly Ave",
    "city": "Not a US Country",
    "state": "AK",
    "postalCode": "90210",
    "country": "GB"
  },
  "destinationAddress": {
    "streetAddress1": "123 Main Ave",
    "streetAddress2": "Apartment 9000",
    "streetAddress3": "Montmârtre",
    "city": "Anytown",
    "state": "AL",
    "postalCode": "90210",
    "country": "US"
  },
  "shipmentType": "HHG"
}

Screenshot 2024-10-11 at 3 55 00 PM

Agility ticket

Summary

Discovered that the service member profile creation/update flow does not use the expected service objects and instead uses a function in the models file. Updating that function to include country_id when saving the service member.

How to test

  1. Access MM as a customer
  2. Create your profile & your addresses
  3. Check out the addresses table and ensure that the country_id is populated

@danieljordan-caci danieljordan-caci added Mountain Movers Movin' Mountains 1 Sprint at a time MAIN labels Oct 4, 2024
@danieljordan-caci danieljordan-caci self-assigned this Oct 4, 2024
@transcom transcom deleted a comment from robot-mymove Oct 11, 2024
@danieljordan-caci danieljordan-caci marked this pull request as ready for review October 22, 2024 21:42
@danieljordan-caci danieljordan-caci requested a review from a team as a code owner October 22, 2024 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MAIN Mountain Movers Movin' Mountains 1 Sprint at a time
Development

Successfully merging this pull request may close these issues.

2 participants