Serialize lifecycle changes and make cancellation, deadlines, and match side effects recoverable and idempotent. Archive accepted bids durably, quarantine invalid payloads, and preserve compatibility with empty round IDs. Synchronize HTTP polling and socket state with scoped resync events. Add cancellation cleanup index migration and regression coverage. Validated with 744 API tests, 65 Redis integration tests, and 28 Mongo integration tests.
145 lines
2.7 KiB
TypeScript
145 lines
2.7 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()
|
|
@IsString()
|
|
clientObservedBidRoundId?: string;
|
|
|
|
@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;
|
|
}
|