Add API endpoint for top win-loss CTF records

This commit is contained in:
Brian Beck 2021-05-30 01:57:00 -07:00
parent c8402074b4
commit 1949494098
5 changed files with 271 additions and 58 deletions

View file

@ -1,9 +1,6 @@
import { IsOptional, IsPositive, IsNotEmpty, IsIn, Max } from 'class-validator';
const filterableGameTypes = [
'CTFGame',
'LakRabbitGame'
] as const;
const filterableGameTypes = ['CTFGame', 'LakRabbitGame'] as const;
type FilterableGameType = typeof filterableGameTypes[number];
@ -14,12 +11,12 @@ const hitStats = [
'laserHitsTG',
'laserMATG',
'cgHitsTG',
'shockHitsTG'
'shockHitsTG',
] as const;
type Stat = typeof hitStats[number];
export class TopPlayersQueryDto {
export class TopAccuracyQueryDto {
@IsNotEmpty()
@IsIn(hitStats as any)
stat: Stat;
@ -41,3 +38,14 @@ export class TopPlayersQueryDto {
@Max(100)
limit: number;
}
export class TopWinsQueryDto {
@IsOptional()
@IsPositive()
minGames: number;
@IsOptional()
@IsPositive()
@Max(100)
limit: number;
}