diff --git a/src/faction/faction.dto.ts b/src/faction/faction.dto.ts index 1db90ceedeafb78cd9068da1ae834820382f33d3..a5b9f044bdf74edefa37ac077e09a3e384e5e5c3 100644 --- a/src/faction/faction.dto.ts +++ b/src/faction/faction.dto.ts @@ -4,6 +4,9 @@ import { Validate, IsString, IsNotEmpty, + IsNumber, + Min, + Max, } from 'class-validator'; import { GameEntity } from '../game/game.entity'; @@ -14,9 +17,15 @@ import { FactionEntity, GameGroupEntity } from './faction.entity'; export class FactionDTO { @IsString() @IsNotEmpty() - @Length(2, 15) + @Length(2, 31) factionName: string; + @IsString() + @IsNotEmpty() + @Length(3, 15) factionPassword: string; + @IsNumber() + @Min(1) + @Max(3) multiplier?: number; game: GameDTO; } diff --git a/src/game/game.dto.ts b/src/game/game.dto.ts index e4f12e3049dc978dcb5aecff2c20aabde9bb08a2..5549aa0f06417670aae943595d15a54d5dcdeff1 100644 --- a/src/game/game.dto.ts +++ b/src/game/game.dto.ts @@ -40,7 +40,8 @@ export class GameDTO { @IsDateString() @IsNotEmpty() enddate: string; - @Allow() + @ValidateNested() + @Type(() => FactionDTO) factions?: FactionDTO[]; @Allow() objective_points?: FlagboxDTO[];