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
feat: Add missing endpoints and normalize customer and currency endpoints for storefront #7160
Conversation
…ints for storefront
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Ignored Deployments
|
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.
some comments to be addressed, but overall lgtm!
@Type(() => StoreGetCurrenciesParams) | ||
$or?: StoreGetCurrenciesParams[] | ||
} | ||
export type StoreGetCurrenciesParamsType = z.infer< |
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.
q: is this type getting inferred correctly for you? I'm getting any
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.
@riqwan it seems it doesn't, nice catch. It is a general issue though it seems, not specific to the currencies.
req.remoteQueryConfig.fields | ||
) | ||
|
||
res.status(200).json({ customer }) |
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.
shouldn't this return address? Feels weird to be returning the customer 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.
@riqwan based on our conventions we respond with the parent object, this just follows the same pattern (you can get the addresses from the customer
). If you feel like it's strange can you raise it in eng-core
and let's discuss it there?
{ | ||
method: ["POST"], | ||
matcher: "/store/customers/me/addresses", | ||
middlewares: [transformBody(StorePostCustomersMeAddressesReq)], | ||
middlewares: [ | ||
validateAndTransformBody(StoreCreateCustomerAddress), | ||
validateAndTransformQuery( | ||
StoreGetCustomerParams, | ||
QueryConfig.retrieveTransformQueryConfig | ||
), | ||
], | ||
}, | ||
{ | ||
method: ["GET"], | ||
matcher: "/store/customers/me/addresses/:address_id", | ||
middlewares: [ | ||
validateAndTransformQuery( | ||
StoreGetCustomerAddressParams, | ||
QueryConfig.retrieveAddressTransformQueryConfig | ||
), | ||
], | ||
}, |
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.
the returns of these 2 should be consistent imo
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.
@riqwan same comment as above, but this is what we decided when you do a POST on a child entity
export type StoreGetCustomerParamsType = z.infer<typeof StoreGetCustomerParams> | ||
export type StoreCreateCustomerType = z.infer<typeof StoreCreateCustomer> | ||
export type StoreUpdateCustomerType = z.infer<typeof StoreUpdateCustomer> | ||
export type StoreGetCustomerAddressParamsType = z.infer< | ||
typeof StoreGetCustomerAddressParams | ||
> | ||
export type StoreGetCustomerAddressesParamsType = z.infer< | ||
typeof StoreCreateCustomerAddress | ||
> | ||
export type StoreCreateCustomerAddressType = z.infer< | ||
typeof StoreCreateCustomerAddress | ||
> | ||
export type StoreUpdateCustomerAddressType = z.infer< | ||
typeof StoreUpdateCustomerAddress | ||
> |
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.
q: didn't we agree on setting these close to their values? Did that change?
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.
@riqwan since you raised the point of the order in which things are defined I put them at the end here, and we can probably do it in other places as necessary. I don't think it matters that much TBH
@riqwan I'm gonna merge as for the time being the comments are not tied to this PR, but let's please discuss the pattern of returning the parent object on POST |
No description provided.