-
Notifications
You must be signed in to change notification settings - Fork 1
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
added pagination, modified events.controller and events.service in Fi… #21
Conversation
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.
Nice, works perfectly!
Just one thing, unfortunately swagger can't detect the optional parameters in the controller method, so it treats the query params as required.
this can be fixed with an @apiquery decorator
https://stackoverflow.com/questions/72131909/nestjs-typeorm-optional-query-not-working
just a quick ping here, don't forget this, only a small fix is required @pem00 |
async findAll(): Promise<Event[]> { | ||
return this.eventsService.findAll(); | ||
@ApiQuery({ name: 'skip', type: Number }) | ||
@ApiQuery({ name: 'take', type: Number }) | ||
async findAll( | ||
@Query('skip', new DefaultValuePipe(0), ParseIntPipe) skip?: number, | ||
@Query('take', new DefaultValuePipe(10), ParseIntPipe) take?: number | ||
): Promise<Event[]> { | ||
return this.eventsService.findAll(take, skip); | ||
} |
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.
the DefaultValuePipe is a nice addition, but please also add the required: false flag to the @ApiQuery-s, so that swagger will allow empty values (and then the default value will be used)
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.
good work, keep it up!
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
added pagination to event findall() using Offset pagination in events.service.ts, using the endDate dates for the descending order