mirror of
https://github.com/amineo/t2-stat-parser.git
synced 2026-01-20 01:34:47 +00:00
Tweak return limits
This commit is contained in:
parent
8e5cf83d4d
commit
9e40b300f5
|
|
@ -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'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue