mirror of
https://github.com/amineo/t2-stat-parser.git
synced 2026-01-19 17:34:43 +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) {
|
async findAll(paginationQuery: PaginationQueryDto) {
|
||||||
const { limit, offset } = paginationQuery;
|
const { limit, offset } = paginationQuery;
|
||||||
|
const returnMaxLimit = Math.min(300, Math.max(0, limit));
|
||||||
|
|
||||||
const games = await this.gamesRepository.find({
|
const games = await this.gamesRepository.find({
|
||||||
skip: offset,
|
skip: offset,
|
||||||
take: limit,
|
take: returnMaxLimit,
|
||||||
order: {
|
order: {
|
||||||
gameId: 'DESC'
|
gameId: 'DESC'
|
||||||
}
|
}
|
||||||
|
|
@ -31,9 +33,12 @@ export class GamesService {
|
||||||
|
|
||||||
async findAllWithSummary(paginationQuery: PaginationQueryDto) {
|
async findAllWithSummary(paginationQuery: PaginationQueryDto) {
|
||||||
const { limit, offset } = paginationQuery;
|
const { limit, offset } = paginationQuery;
|
||||||
|
|
||||||
|
const returnMaxLimit = Math.min(100, Math.max(0, limit));
|
||||||
|
|
||||||
const games = await this.gamesRepository.find({
|
const games = await this.gamesRepository.find({
|
||||||
skip: offset,
|
skip: offset,
|
||||||
take: limit,
|
take: returnMaxLimit,
|
||||||
order: {
|
order: {
|
||||||
gameId: 'DESC'
|
gameId: 'DESC'
|
||||||
}
|
}
|
||||||
|
|
@ -67,10 +72,13 @@ export class GamesService {
|
||||||
|
|
||||||
async findByTypeWithSummary(gametype: string, paginationQuery: PaginationQueryDto) {
|
async findByTypeWithSummary(gametype: string, paginationQuery: PaginationQueryDto) {
|
||||||
const { limit, offset } = paginationQuery;
|
const { limit, offset } = paginationQuery;
|
||||||
|
|
||||||
|
const returnMaxLimit = Math.min(100, Math.max(0, limit));
|
||||||
|
|
||||||
const games = await this.gamesRepository.find({
|
const games = await this.gamesRepository.find({
|
||||||
where: { gametype: gametype },
|
where: { gametype: gametype },
|
||||||
skip: offset,
|
skip: offset,
|
||||||
take: limit,
|
take: returnMaxLimit,
|
||||||
order: {
|
order: {
|
||||||
gameId: 'DESC'
|
gameId: 'DESC'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,14 @@ export class PlayersService {
|
||||||
|
|
||||||
async findAll(paginationQuery: PaginationQueryDto) {
|
async findAll(paginationQuery: PaginationQueryDto) {
|
||||||
const { limit, offset } = paginationQuery;
|
const { limit, offset } = paginationQuery;
|
||||||
|
|
||||||
|
const returnMaxLimit = Math.min(300, Math.max(0, limit));
|
||||||
|
|
||||||
const players = await this.playersRepository.find({
|
const players = await this.playersRepository.find({
|
||||||
skip: offset,
|
skip: offset,
|
||||||
take: limit,
|
take: returnMaxLimit,
|
||||||
order: {
|
order: {
|
||||||
playerName: 'DESC'
|
updatedAt: 'DESC'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue