141 lines
2.6 KiB
TypeScript
141 lines
2.6 KiB
TypeScript
import { Type } from 'class-transformer';
|
|
import {
|
|
ArrayMaxSize,
|
|
ArrayMinSize,
|
|
IsArray,
|
|
IsEnum,
|
|
IsInt,
|
|
IsMongoId,
|
|
IsOptional,
|
|
IsString,
|
|
IsUUID,
|
|
Max,
|
|
Min,
|
|
ValidateNested,
|
|
} from 'class-validator';
|
|
import { AUCTION_TOP_TIER_THRESHOLDS } from '../../global/database/schema';
|
|
|
|
export type AuctionTopTierThreshold =
|
|
(typeof AUCTION_TOP_TIER_THRESHOLDS)[number];
|
|
|
|
class CaptainAssignmentDto {
|
|
@IsInt()
|
|
@Min(1)
|
|
teamIndex!: number;
|
|
|
|
@IsMongoId()
|
|
userId!: string;
|
|
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(100)
|
|
@Max(100000)
|
|
initialTeamBidPointAmount?: number;
|
|
}
|
|
|
|
export class StartAuctionDto {
|
|
@IsUUID()
|
|
startAuctionRequestId!: string;
|
|
|
|
@IsArray()
|
|
@ArrayMinSize(2)
|
|
@ArrayMaxSize(16)
|
|
@ValidateNested({ each: true })
|
|
@Type(() => CaptainAssignmentDto)
|
|
captains!: CaptainAssignmentDto[];
|
|
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(100)
|
|
@Max(100000)
|
|
initialTeamBidPointAmount?: number;
|
|
|
|
@IsOptional()
|
|
@IsEnum(AUCTION_TOP_TIER_THRESHOLDS)
|
|
topTierAuctionPriorityThreshold?: AuctionTopTierThreshold;
|
|
|
|
@IsOptional()
|
|
@IsArray()
|
|
@ArrayMaxSize(100)
|
|
@IsMongoId({ each: true })
|
|
manualTopTierAuctionPriorityUserIds?: string[];
|
|
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(5)
|
|
maximumBidRoundDurationSeconds?: number;
|
|
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(0)
|
|
bidRoundExtensionSeconds?: number;
|
|
}
|
|
|
|
export class PlaceBidDto {
|
|
@IsOptional()
|
|
@IsUUID()
|
|
bidRequestId?: string;
|
|
|
|
@IsInt()
|
|
@Min(1)
|
|
bidderTeamIndex!: number;
|
|
|
|
@IsInt()
|
|
@Min(1)
|
|
bidPointAmount!: number;
|
|
|
|
@IsOptional()
|
|
clientObservedAuctionLifecycleId?: string;
|
|
|
|
@IsOptional()
|
|
clientObservedCurrentBidRoundPlayerUserId?: string;
|
|
}
|
|
|
|
export class AuctionActionRequestDto {
|
|
@IsOptional()
|
|
@IsUUID()
|
|
auctionActionRequestId?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
clientObservedAuctionLifecycleId?: string;
|
|
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(0)
|
|
clientObservedRevision?: number;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
clientObservedPhase?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
clientObservedCurrentBidRoundPlayerUserId?: string;
|
|
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(0)
|
|
clientObservedCurrentAuctionPlayerOrderIndex?: number;
|
|
}
|
|
|
|
export class SoldDto extends AuctionActionRequestDto {
|
|
@IsOptional()
|
|
@IsEnum(['TOP', 'JGL', 'MID', 'ADC', 'SUP'])
|
|
assignedPosition?: 'TOP' | 'JGL' | 'MID' | 'ADC' | 'SUP';
|
|
}
|
|
|
|
export class OpenBiddingDto extends AuctionActionRequestDto {}
|
|
|
|
export class NextAuctionDto extends AuctionActionRequestDto {}
|
|
|
|
export class PassedAuctionDto extends AuctionActionRequestDto {}
|
|
|
|
export class ResetAuctionDto extends AuctionActionRequestDto {}
|
|
|
|
export class UndoAuctionDto extends AuctionActionRequestDto {
|
|
@IsInt()
|
|
@Min(1)
|
|
sequence!: number;
|
|
}
|