mirror of
http://172.20.10.11:3000/gitadmin/INSIGHT-MVP.git
synced 2026-06-24 21:16:40 +02:00
fix: convert query params to numbers for pagination
@Query() decorator always returns strings. Using Number() conversion with fallback to defaults (page=1, limit=20) to prevent NaN errors in Prisma findMany skip/take calculations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4d5d5bac88
commit
bd00ea5e50
2 changed files with 12 additions and 6 deletions
|
|
@ -33,10 +33,13 @@ export class TenantsController {
|
|||
@UseGuards(RolesGuard)
|
||||
@ApiOperation({ summary: 'Alle Mandanten auflisten (Admin)' })
|
||||
async findAll(
|
||||
@Query('page') page?: number,
|
||||
@Query('limit') limit?: number,
|
||||
@Query('page') page?: string,
|
||||
@Query('limit') limit?: string,
|
||||
) {
|
||||
return this.tenantsService.findAll(page ?? 1, limit ?? 20);
|
||||
return this.tenantsService.findAll(
|
||||
Number(page) || 1,
|
||||
Number(limit) || 20,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -42,10 +42,13 @@ export class UsersController {
|
|||
@UseGuards(RolesGuard)
|
||||
@ApiOperation({ summary: 'Alle Benutzer auflisten (Admin)' })
|
||||
async findAll(
|
||||
@Query('page') page?: number,
|
||||
@Query('limit') limit?: number,
|
||||
@Query('page') page?: string,
|
||||
@Query('limit') limit?: string,
|
||||
) {
|
||||
return this.usersService.findAll(page ?? 1, limit ?? 20);
|
||||
return this.usersService.findAll(
|
||||
Number(page) || 1,
|
||||
Number(limit) || 20,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue