diff --git a/app/api/src/games/games.service.ts b/app/api/src/games/games.service.ts index 94fdf46..2482c28 100644 --- a/app/api/src/games/games.service.ts +++ b/app/api/src/games/games.service.ts @@ -18,9 +18,11 @@ export class GamesService { async findAll(paginationQuery: PaginationQueryDto) { const { limit, offset } = paginationQuery; + const returnMaxLimit = Math.min(300, Math.max(0, limit)); + const games = await this.gamesRepository.find({ skip: offset, - take: limit, + take: returnMaxLimit, order: { gameId: 'DESC' } @@ -31,9 +33,12 @@ export class GamesService { async findAllWithSummary(paginationQuery: PaginationQueryDto) { const { limit, offset } = paginationQuery; + + const returnMaxLimit = Math.min(100, Math.max(0, limit)); + const games = await this.gamesRepository.find({ skip: offset, - take: limit, + take: returnMaxLimit, order: { gameId: 'DESC' } @@ -67,10 +72,13 @@ export class GamesService { async findByTypeWithSummary(gametype: string, paginationQuery: PaginationQueryDto) { const { limit, offset } = paginationQuery; + + const returnMaxLimit = Math.min(100, Math.max(0, limit)); + const games = await this.gamesRepository.find({ where: { gametype: gametype }, skip: offset, - take: limit, + take: returnMaxLimit, order: { gameId: 'DESC' } diff --git a/app/api/src/players/players.service.ts b/app/api/src/players/players.service.ts index 860f024..176ba5a 100644 --- a/app/api/src/players/players.service.ts +++ b/app/api/src/players/players.service.ts @@ -18,11 +18,14 @@ export class PlayersService { async findAll(paginationQuery: PaginationQueryDto) { const { limit, offset } = paginationQuery; + + const returnMaxLimit = Math.min(300, Math.max(0, limit)); + const players = await this.playersRepository.find({ skip: offset, - take: limit, + take: returnMaxLimit, order: { - playerName: 'DESC' + updatedAt: 'DESC' } });