-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Take limit in ListOptions #751
Comments
I agree that we need this. I'm not sure how it should be configured. Some ideas:
|
As a general remark, we would like to be able to distinguish between the Admin API and the Shop API. We would like to set the limit on the Shop API a lot lower.
In conclusion, my preference goes out to Option 2. |
If defining a custom scalar, the question remains of how to make it configurable? Would you provide your own with an identical name to the built-in one to override it? |
I might not be familiar enough with all concepts of NestJS, but Custom Scalars have to be included in the Module as a provider, so I suppose they support dependency injection? In that case the config can be read. |
If we are going to be reading from the ConfigService anyway, I think the best & simplest method then is to inject the ConfigService into the ListQueryBuilder and read the max value in |
What I meant by that is that the API would still expose an
However I feel that I am really nitpicking at this point. What matters most for us is that the limit on the shop and admin API can be set differently. |
Got it, thanks for the explanation. One option to make the limit more explicit would be to throw a UserInputError when attempting to take too many. |
Hello @michaelbromley Is it okay? Why? How can I set restriction for search{ } also? |
Hi @alex-dwt. This is because the |
Thanks for a full description @michaelbromley
And because of |
Is your feature request related to a problem? Please describe.
When running a Vendure instance that contains many Products and ProductVariants, it is currently possible to query all products at once as there is no limit for the
take
input. This is obviously not desired as this can easily bring down the server.Describe the solution you'd like
Allow to define a limit and default value for the
take
variable inListOptions
andSearchInput
.Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: