Skip to content
Snippets Groups Projects
Commit a9f76d3f authored by L4168's avatar L4168
Browse files

cleaning up dto

parent 727642cc
No related branches found
No related tags found
4 merge requests!59Development to master,!31Development,!26Piirto2,!25Dto service
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()
......
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