import { Transform } from 'class-transformer'; import { ArrayMinSize, IsArray, IsOptional, IsString, IsUrl, Length, Matches, } from 'class-validator'; const CODE_PATTERN = /^[A-Z0-9]{8}$/; export class PublicSimulationCodeQueryDto { @IsOptional() @Transform(({ value }) => typeof value === 'string' ? value.trim().toUpperCase() : value, ) @IsString() @Length(8, 8) @Matches(CODE_PATTERN) code?: string; } export class CreatePublicSimulationDto { @Transform(({ value }) => typeof value === 'string' ? value.trim().toUpperCase() : value, ) @IsString() @Length(8, 8) @Matches(CODE_PATTERN) inviteCode!: string; @IsUrl() originImage!: string; @IsArray() @ArrayMinSize(1) @IsString({ each: true }) templateIds!: string[]; @IsOptional() @IsString() simulateRemark?: string; }