Twaha-Rahman/e-commercify

[REQUEST] Add pager option for GraphQL endpoints which return a list

Closed this issue · 6 comments

Is your feature request related to a problem? Please describe.

Currently the API endpoints which return lists return a list with all the items, which isn't ideal.

Describe the solution you would like

We need to build a pager feature which will allows us to get x amount of items by default. Or if the the request provides the amount of items it wants, then return that number of items.

Issue-Label Bot is automatically applying the label enhancement to this issue, with a confidence of 1.00. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

Mongoose provides a .limit() method on queries, so this should be easy to implement.

Do you have a suggestion for the default number of items?
Or should the number of items be always specified in every non-mutating query?

Mongoose provides a .limit() method on queries, so this should be easy to implement.

Do you have a suggestion for the default number of items?
Or should the number of items be always specified in every non-mutating query?

There'll be an environment variable for the default number of items. Any query can have an itemLimit property to override that default number of item.

Ok so what should be the name of this environment variable? DEFAULT_ITEM_LIMIT ?

Ok so what should be the name of this environment variable? DEFAULT_ITEM_LIMIT ?

That's completely upto you. Name it something you think best describes it.

Well I think it should be consistent with the name used in queries