61 lines
1.0 KiB
TypeScript
61 lines
1.0 KiB
TypeScript
import { Type } from 'class-transformer';
|
|
import {
|
|
ArrayMaxSize,
|
|
ArrayMinSize,
|
|
IsArray,
|
|
IsEnum,
|
|
IsInt,
|
|
IsMongoId,
|
|
IsOptional,
|
|
Min,
|
|
ValidateNested,
|
|
} from 'class-validator';
|
|
import { TEAM_SIDES } from '../../global/database/schema';
|
|
import type { TeamSide } from '../../global/database/schema';
|
|
|
|
class CaptainAssignmentDto {
|
|
@IsEnum(TEAM_SIDES)
|
|
side!: TeamSide;
|
|
|
|
@IsMongoId()
|
|
userId!: string;
|
|
}
|
|
|
|
export class StartAuctionDto {
|
|
@IsArray()
|
|
@ArrayMinSize(2)
|
|
@ArrayMaxSize(2)
|
|
@ValidateNested({ each: true })
|
|
@Type(() => CaptainAssignmentDto)
|
|
captains!: CaptainAssignmentDto[];
|
|
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(1)
|
|
initialPoints?: number;
|
|
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(5)
|
|
maxTimerSeconds?: number;
|
|
}
|
|
|
|
export class PlaceBidDto {
|
|
@IsEnum(TEAM_SIDES)
|
|
side!: TeamSide;
|
|
|
|
@IsInt()
|
|
@Min(1)
|
|
amount!: number;
|
|
|
|
@IsOptional()
|
|
@IsMongoId()
|
|
bidderUserId?: string;
|
|
}
|
|
|
|
export class SoldDto {
|
|
@IsOptional()
|
|
@IsEnum(['TOP', 'JGL', 'MID', 'ADC', 'SUP'])
|
|
assignedPosition?: 'TOP' | 'JGL' | 'MID' | 'ADC' | 'SUP';
|
|
}
|