Merge pull request #5 from exogen/feature/top-winning-percentage

Add API endpoint for top win-loss CTF records
This commit is contained in:
Anthony Mineo 2021-05-30 08:30:21 -04:00 committed by GitHub
commit ab028e52fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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;
}