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

feat: Add missing endpoints and normalize customer and currency endpoints for storefront #7160

Merged
merged 1 commit into from Apr 29, 2024

Conversation

sradevski
Copy link
Member

No description provided.

Copy link

changeset-bot bot commented Apr 26, 2024

⚠️ No Changeset found

Latest commit: 3777481

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Apr 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
medusa-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 26, 2024 3:10pm
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Apr 26, 2024 3:10pm
docs-ui ⬜️ Ignored (Inspect) Visit Preview Apr 26, 2024 3:10pm
medusa-docs ⬜️ Ignored (Inspect) Visit Preview Apr 26, 2024 3:10pm

Copy link
Contributor

@riqwan riqwan left a 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<
Copy link
Contributor

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

Copy link
Member Author

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 })
Copy link
Contributor

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

Copy link
Member Author

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?

Comment on lines 67 to 87
{
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
),
],
},
Copy link
Contributor

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

Copy link
Member Author

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

Comment on lines +46 to +60
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
>
Copy link
Contributor

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?

Copy link
Member Author

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

@sradevski
Copy link
Member Author

@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

@sradevski sradevski merged commit 32c2a9d into develop Apr 29, 2024
24 checks passed
@sradevski sradevski deleted the feat/fixes-customer-currency-endpoints branch April 29, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants