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

Default page value or limit is pagination #213

Closed
bashleigh opened this issue Aug 13, 2019 · 11 comments
Closed

Default page value or limit is pagination #213

bashleigh opened this issue Aug 13, 2019 · 11 comments

Comments

@bashleigh
Copy link
Collaborator

When setting a default limit (global config) I expected to get a paginated response back. However I get a limited list of 10 items and no pagination. I have to specify a page query parameter in order for the pagination response to display.

Should we:

  • (A) add a default value for page?
  • (B) page defaults to 1 when limit set and no page defined?
  • (C) add an option for default value of page
@michaelyali
Copy link
Member

according to #114 I'm thinking about always sending a response with pagination by default

@bashleigh
Copy link
Collaborator Author

@zMotivat0r cool :) want some help?

@michaelyali
Copy link
Member

Sure. I need to prioritize issues this week someday somehow :(

@bashleigh
Copy link
Collaborator Author

@zMotivat0r ahh man, too busy? Know the feeling 😂 no time for OSS

@jdguzman
Copy link
Contributor

jdguzman commented Oct 2, 2019

@zMotivat0r is this still something that needs attention? We have run into this and were wanting to dive in and help out.

@michaelyali
Copy link
Member

I'm planning to return paginated values always by default with the option of fallback to what we have now, something like alwaysPaginate: false

@jdguzman
Copy link
Contributor

jdguzman commented Oct 3, 2019

alwaysPaginate would be a global config option I suppose?

@jdguzman
Copy link
Contributor

jdguzman commented Oct 3, 2019

@zMotivat0r is there a doc somewhere that goes over setting this up locally to contirbute? I've got docker-compose running and have done a yarn install but when I run yarn test I get ../../packages/crud/src/interceptors/crud-request.interceptor.ts:7:36 - error TS2307: Cannot find module '@nestjsx/crud-request/lib/request-query.parser'. Looks like tsconfig has aliases but they don't seem to map the lib directory in crud-request.

@michaelyali
Copy link
Member

@jdguzman
https://github.com/nestjsx/crud/wiki#tests

alwaysPaginate would be a global config option I suppose?

yep

@jdguzman
Copy link
Contributor

jdguzman commented Oct 4, 2019

@zMotivat0r yeah ok the steps in that wiki are what I was following but I get resolution errors. I'll paste the output here, but is there a gitter or some other form of communication you prefer?

[18:55:43] jdg ~/dev…s-projects/crud ᚴ [master] $ yarn bootstrap
yarn run v1.9.4
$ npx lerna bootstrap
lerna notice cli v3.15.0
lerna info bootstrap root only
[1/4] 🔍  Resolving packages...
success Already up-to-date.
$ npx opencollective
                         Thanks for installing nestjsx 🙏
                 Please consider donating to our open collective
                        to help us maintain this package.

                            Number of contributors: 44
                               Number of backers: 5
                               Annual budget: $730
                              Current balance: $407

     👉  Become a partner: https://opencollective.com/nestjsx/donate

✨  Done in 3.53s.


[19:37:41] jdg ~/dev…s-projects/crud ᚴ [master] $ yarn build
yarn run v1.9.4
$ yarn s build
$ npx nps build
nps is executing `build` : nps build.util && nps build.crud-request && nps build.crud && nps build.crud-typeorm
nps is executing `build.util` : npx lerna run build --scope @nestjsx/util
lerna notice cli v3.15.0
lerna info filter [ '@nestjsx/util' ]
lerna info Executing command in 1 package: "yarn run build"
lerna info run Ran npm script 'build' in '@nestjsx/util' in 3.7s:
$ npx rimraf ./lib
$ npx tsc -b
lerna success run Ran npm script 'build' in 1 package in 3.8s:
lerna success - @nestjsx/util
nps is executing `build.crud-request` : npx lerna run build --scope @nestjsx/crud-request
lerna notice cli v3.15.0
lerna info filter [ '@nestjsx/crud-request' ]
lerna info Executing command in 1 package: "yarn run build"
lerna info run Ran npm script 'build' in '@nestjsx/crud-request' in 3.7s:
$ npx rimraf ./lib
$ npx tsc -b
lerna success run Ran npm script 'build' in 1 package in 3.7s:
lerna success - @nestjsx/crud-request
nps is executing `build.crud` : npx lerna run build --scope @nestjsx/crud
lerna notice cli v3.15.0
lerna info filter [ '@nestjsx/crud' ]
lerna info Executing command in 1 package: "yarn run build"
lerna ERR! yarn run build exited 1 in '@nestjsx/crud'
lerna ERR! yarn run build stdout:
$ npx rimraf ./lib
$ npx tsc -b
src/interceptors/crud-request.interceptor.ts(7,36): error TS2307: Cannot find module '@nestjsx/crud-request/lib/request-query.parser'.
src/interfaces/crud-request.interface.ts(1,37): error TS2307: Cannot find module '@nestjsx/crud-request/lib/interfaces'.
src/interfaces/params-options.interface.ts(1,33): error TS2307: Cannot find module '@nestjsx/crud-request/lib/types/request-param.types'.
src/interfaces/query-options.interface.ts(5,8): error TS2307: Cannot find module '@nestjsx/crud-request/lib/types/request-query.types'.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

lerna ERR! yarn run build stderr:
error Command failed with exit code 1.

lerna ERR! yarn run build exited 1 in '@nestjsx/crud'
The script called "build.crud" which runs "npx lerna run build --scope @nestjsx/crud" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.9.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
The script called "build" which runs "nps build.util && nps build.crud-request && nps build.crud && nps build.crud-typeorm" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.9.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@jdguzman
Copy link
Contributor

jdguzman commented Oct 8, 2019

@zMotivat0r I was able to get everything setup. Not sure what was happening but I trashed the repo and recloned and all was good. I'm going to look into putting a PR together for this.

jdguzman added a commit to jdguzman/crud that referenced this issue Oct 9, 2019
…ation default

BREAKING CHANGE: getManyBase now returns a paginated result by default unless opted out by setting
`alwaysPaginate: false`

re nestjsx#213
jdguzman added a commit to jdguzman/crud that referenced this issue Oct 9, 2019
…ation default

BREAKING CHANGE: getManyBase now returns a paginated result by default unless opted out by setting
`alwaysPaginate: false`

re nestjsx#213
jdguzman added a commit to jdguzman/crud that referenced this issue Oct 9, 2019
…ation default

BREAKING CHANGE: getManyBase now returns a paginated result by default unless opted out by setting
`alwaysPaginate: false`

re nestjsx#213
jdguzman added a commit to jdguzman/crud that referenced this issue Oct 9, 2019
…ation default

BREAKING CHANGE: getManyBase now returns a paginated result by default unless opted out by setting
`alwaysPaginate: false`

re nestjsx#213
jdguzman added a commit to jdguzman/crud that referenced this issue Oct 29, 2019
…ation default

BREAKING CHANGE: getManyBase now returns a paginated result by default unless opted out by setting
`alwaysPaginate: false`

re nestjsx#213
yharaskrik pushed a commit to yharaskrik/crud that referenced this issue Dec 24, 2019
…ation default

BREAKING CHANGE: getManyBase now returns a paginated result by default unless opted out by setting
`alwaysPaginate: false`

re nestjsx#213
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants