-
Notifications
You must be signed in to change notification settings - Fork 2
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
Pangolin 3184: staged quote model #433
Conversation
🦋 Changeset detectedLatest commit: 4437a73 The changes in this PR will be included in the next version bump. This PR includes changesets to release 28 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
stateRef: TReferenceGraphql | null; | ||
__typename: 'StagedQuote'; | ||
}; | ||
export type TStagedQuoteDraftGraphql = TStagedQuoteDraft; |
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.
Always a sigh of relief when they are symmetrical
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.
Spent time comparing types and they look good to me (with one nit)! My thinking is if those are good then the rest should flow from there.
Nice work as always 🏆
… reflect that there is only a cartRef returned by the graphql api, it does not return the full cart data, also update staged quote types to reflect that quotationCartRef and quoteRequestRef are non-nullable
@@ -56,7 +57,7 @@ const generator = Generator<TQuoteRequest>({ | |||
directDiscounts: [], | |||
state: null, | |||
purchaseOrderNumber: null, | |||
cart: fake(() => Cart.random()), | |||
cart: fake(() => Reference.random().typeId('cart')), |
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.
…nd the things we do to silence them
@@ -139,7 +133,7 @@ const transformers = { | |||
|
|||
const cartRef: TReferenceGraphql = Reference.presets.cartReference | |||
.cartReference() | |||
.id(fields.cart?.id) | |||
.id(fields.cart?.id || '') |
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.
Ninja move!
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.
thanks, this is exactly the sort of thing that I'm never sure is best practice in TS, so I'm glad it's not throwing up any flags for you
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.
It could be me, and honestly there could be a way better action to take here, but there are instances where the graphql types seem to back us into a corner a little bit. @jaikamat do you have thoughts?
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.
Something like
const cartRef: TReferenceGraphql | null = fields.cart
? Reference.presets.cartReference
.cartReference()
.id(fields.cart.id)
.typeId('cart')
.buildGraphql()
: null;
could be more in line with the schema since cartRef
is nullable, and this way we know id
is available
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.
(full disclosure I did that here)
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.
@jaikamat updated
This PR adds a new package for the
StagedQuote
andStagedQuoteDraft
models.