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

added pagination, modified events.controller and events.service in Fi… #21

Merged
merged 5 commits into from
Aug 11, 2024

Conversation

pem00
Copy link
Contributor

@pem00 pem00 commented Jul 2, 2024

added pagination to event findall() using Offset pagination in events.service.ts, using the endDate dates for the descending order

@Tschonti Tschonti linked an issue Jul 2, 2024 that may be closed by this pull request
Copy link
Member

@Tschonti Tschonti left a 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.
image

this can be fixed with an @apiquery decorator
https://stackoverflow.com/questions/72131909/nestjs-typeorm-optional-query-not-working

@Tschonti
Copy link
Member

just a quick ping here, don't forget this, only a small fix is required @pem00

Comment on lines 20 to 39
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);
}
Copy link
Member

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)

Copy link
Member

@Tschonti Tschonti left a 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!

Copy link

vercel bot commented Aug 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
be-alcoholic-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 11, 2024 6:28pm

@Tschonti Tschonti merged commit 73498f8 into main Aug 11, 2024
5 checks passed
@Tschonti Tschonti deleted the feature/17-add-pagination-support branch August 11, 2024 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add pagination support to Event findAll()
2 participants