Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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(medusa): Retrieve (service + controller) a product category #3004
feat(medusa): Retrieve (service + controller) a product category #3004
Changes from 1 commit
b6ecce9
03a84f6
80cd0de
3f27cf9
cfa1532
2a4e9d8
bd5dc41
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
todo: rm
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.
hmm, now that i look at this, i do need to add a
{ where: { is_internal: false, is_active: true } }
scope to the store endpoints. How is this typically done? Do i create a new repo method that accepts the extra scope arg? BecauseExtendedFindConfig
is used exclusively for list endpoints. @adrien2p @pKorsholmThere 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.
You can create a method in the service retrieveActiveNonInternal or something like that (can't find a good 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.
sometimes what I do is the following:
selector
,config
you can look at the product service as an example
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.
Would it make sense to add fixed filter params for store endpoint instead of a dedicated method?
E.g. in
/store/products
we add"published"
as a fixed filter in the controllers.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 we shouldn't create dedicated retrieve methods for what is just a filter. That does not scale super well 🤔
Wdyt?
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 creating a retrieve method that takes a
selector
(maybestring | selector
, where string is just an id) as @adrien2p suggested is a good approach, then you could add the parameters as awhere
object.In that way you get all the retrieveByEmail etc. we have elsewhere as well and can create the filter in the controller as Oli suggests 😄