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

added validation for FlagBoxEvent

parent ef633605
No related branches found
No related tags found
4 merge requests!59Development to master,!31Development,!26Piirto2,!25Dto service
...@@ -5,6 +5,8 @@ import { ...@@ -5,6 +5,8 @@ import {
IsDateString, IsDateString,
IsNumber, IsNumber,
Validate, Validate,
Min,
Max,
} from 'class-validator'; } from 'class-validator';
import { ObjectivePointEntity } from './game.entity'; import { ObjectivePointEntity } from './game.entity';
import { CenterJSON } from '../shared/custom-validation'; import { CenterJSON } from '../shared/custom-validation';
...@@ -72,10 +74,22 @@ export class FlagboxDTO { ...@@ -72,10 +74,22 @@ export class FlagboxDTO {
} }
export class FlagboxEventDTO { export class FlagboxEventDTO {
@IsString()
@IsNotEmpty()
@Length(7)
node_id: string; node_id: string;
owner: number; @IsNumber()
action: number; @Min(0)
capture: number; @Max(3)
owner: number; // owner = 0, => first entry in faction db, owner = 1, => second entry etc
@IsNumber()
@Min(0)
@Max(3)
action: number; // 0=no capture ongoing, 1=captured, 2=capture ongoing
@IsNumber()
@Min(0)
@Max(3)
capture: number; // which faction is capturing, same logic as in owner with numbers
oP_HistoryTimestamp?: string; oP_HistoryTimestamp?: string;
objective_point?: ObjectivePointEntity; objective_point?: ObjectivePointEntity;
} }
......
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