Newer
Older
import {
IsString,
IsDateString,
IsJSON,
IsNotEmpty,
Length,
import { ArrayLength } from 'src/shared/array-validation';
// uses class-validator built in validations
// see https://github.com/typestack/class-validator
@IsString()
@IsNotEmpty()
@Length(2, 31)
name: string;
@IsString()
@IsNotEmpty()
@Length(1, 255)
desc: string;
// doesn't accept with IsJSON, WIP to get validation for map and center
// IsJSON checks with json.parse, expecting string
@IsDateString()
@IsNotEmpty()
startdate: string;
@IsDateString()
@IsNotEmpty()
enddate: string;
// custom validation for array length (arr>min, arr<max)
}
export class FactionDTO {
@IsString()
@IsNotEmpty()
@Length(2, 15)
name: string;
id: string;
game: GameDTO;