-
Notifications
You must be signed in to change notification settings - Fork 35
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 18911 gun safe backend #12557
Conversation
…ayload" and "CounselingUpdateAllowancePayload" in ghc.yaml
…kg/models file. Added if statement for gunsafe in order_updater.go
…B to NOT NULL and added migration file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
verify rpt: there were diffs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…ymove into MAIN-B-18911-gun-safe-backend
-- 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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line is taken care of in the above migration file?
ALTER COLUMN gun_safe SET DEFAULT false,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, in my original migration that added the gun_safe column, it could be either T, F, or null, but after finding that null would error out in some cases, I added this migration to edit the table so that it's only true or false, since that also makes sense logically anyway. Now it defaults to false, and is only set to true if the customer/office user flags that a gun safe is allowed.
B-18910
INT PRs
#12511 #12440
Summary
This branch adds changes to the backend to allow the app to track whether or not a customer has an entitlement to ship a gun safe. Currently the govt. just want's a flag to denote whether this is true or false, no weight calculations/fields have been added.
It also makes the gunSafe entitlement visible to the prime on the backend.
How to test
First PR / general backend
X-CSRF-Token
value in the request headers to the value of themasked_gorilla
cookie.orders
table and find your order with the UUID you noted, go to the entitlement_id column and click the link (in DBeaver, small box to the left of the actual value), to open the appropriate entitlement in theentitlements
table.Second PR / Make Available To Prime
Find a move ID for any available to Prime move in the database using DBeaver, and edit it's gun safe flag to "true". Alternatively, if you want to use postman, using the move ID, issue a PATCH request with "gunSafe: true" in the body to "{{baseUrl}}/move-task-orders/:moveTaskOrderID/post-counseling-info".
Using Postman, access the Prime API and hit the {{baseUrl}}/move-task-orders/:moveID GET endpoint after getting the move id from the Network devtools tab or from a database explorer, inside the "entitlements" object, you should see a "gunSafe" boolean.
You can also verify via Postman that any API endpoint that uses an "Order" object now has a "gunSafe" boolean inside its nested "entitlements" object.
Note: You'll only see the gunSafe field in the object if gunSafe is set to true, otherwise it is not present.