diff --git a/src/game/game.dto.ts b/src/game/game.dto.ts index aa0bc49851e117567637aeaeb035caa93234e657..e188acc97aea3162b6d364218a63d078a8e48edc 100644 --- a/src/game/game.dto.ts +++ b/src/game/game.dto.ts @@ -1,17 +1,10 @@ import { IsNotEmpty, IsString, - IsDate, Length, - IsInt, - Min, - Max, - IsArray, - IsJSON, IsDateString, IsNumber, } from 'class-validator'; -import { Timestamp } from 'typeorm'; import { ObjectivePointEntity } from './game.entity'; export class GameDTO { @@ -23,11 +16,7 @@ export class GameDTO { @Length(1, 255) desc: string; @IsNotEmpty() - //@IsJSON() center: JSON; - //@IsJSON() - // doesn't accept with IsJSON, WIP to get validation for map and center - // IsJSON checks with json.parse, expecting string map?: JSON; nodesettings?: JSON; @IsDateString() @@ -36,12 +25,29 @@ export class GameDTO { @IsDateString() @IsNotEmpty() enddate: string; - // custom validation for array length (arr>min, arr<max) - //@Validate(ArrayLength, [4, 8]) factions?: FactionDTO[]; objective_points?: FlagboxDTO[]; } +export class newGameDTO { + @IsString() + @IsNotEmpty() + @Length(3, 30) + name: string; + @IsString() + @IsNotEmpty() + @Length(1, 255) + desc: string; + @IsNotEmpty() + center: JSON; + @IsDateString() + @IsNotEmpty() + startdate: string; + @IsDateString() + @IsNotEmpty() + enddate: string; +} + export class FactionDTO { @IsString() @IsNotEmpty()