Skip to content
Snippets Groups Projects
Commit 6dacd4ec authored by Ronnie Friman's avatar Ronnie Friman
Browse files

added json validation for editgame factions

parent 54dd811e
No related branches found
No related tags found
3 merge requests!59Development to master,!31Development,!29Json validation
......@@ -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;
}
......
......@@ -40,7 +40,8 @@ export class GameDTO {
@IsDateString()
@IsNotEmpty()
enddate: string;
@Allow()
@ValidateNested()
@Type(() => FactionDTO)
factions?: FactionDTO[];
@Allow()
objective_points?: FlagboxDTO[];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment