Skip to content
Snippets Groups Projects

Dto service

Merged Ghost User requested to merge dto-service into piirto2
1 file
+ 19
13
Compare changes
  • Side-by-side
  • Inline
+ 19
13
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()
Loading