-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
fix(medusa): Support q search and order in list regions #6202
Conversation
🦋 Changeset detectedLatest commit: daa61df The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Ignored Deployments
|
if (q) { | ||
const where = query.where as FindOptionsWhere<Region> | ||
|
||
delete where.name |
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.
@kasperkristensen, only included the name for now. Let me know if this is sufficient.
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.
I think that is fine, the only other option I think would make sense was to allow search by country, like how we have search product variants by product title:
medusa/packages/medusa/src/services/product-variant.ts
Lines 923 to 949 in f29948a
if (q) { | |
query.relations = query.relations ?? {} | |
query.relations["product"] = query.relations["product"] ?? true | |
query.where = query.where as FindOptionsWhere<ProductVariant> | |
delete query.where?.title | |
query.where = query.where ?? {} | |
query.where = [ | |
{ | |
...query.where, | |
title: ILike(`%${q}%`), | |
}, | |
{ | |
...query.where, | |
sku: ILike(`%${q}%`), | |
}, | |
{ | |
...query.where, | |
product: { | |
...((query.where.product ?? | |
{}) as FindOptionsWhere<ProductVariant>), | |
title: ILike(`%${q}%`), | |
}, | |
}, | |
] | |
} |
Would be cool to be able to search "denmark" and then "Europe" pops up, but I am good with leaving that for a future iteration 😄
eb649d6
to
ddfb0b9
Compare
ddfb0b9
to
0b91270
Compare
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!
Closes #6174