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

validation for services

parent 39da24f7
No related branches found
No related tags found
4 merge requests!59Development to master,!31Development,!25Dto service,!24Faction task edit
import {
IsString,
Length,
IsNumber,
IsBoolean,
Min,
Max,
Validate,
IsUUID,
Equals,
} from 'class-validator';
import { FactionEntity } from 'src/game/faction.entity';
import { FactionEntity } from '../game/faction.entity';
import { Uuid } from '../shared/uuid.validation';
import { GameEntity } from 'src/game/game.entity';
export class TaskDTO {
export class CreateTaskDTO {
@IsString()
@Length(3, 31)
taskName: string;
@IsString()
@Length(0, 255)
taskDescription: string;
@IsNumber()
@Min(1)
@Max(99)
taskScore: number;
@IsString()
@Length(3, 31)
taskWinner?: string;
@IsBoolean()
taskIsActive: boolean;
// faction unique id
@IsString()
@Validate(Uuid)
faction: FactionEntity;
@Equals(null)
taskWinner: FactionEntity;
// faction unique id
@IsUUID('4')
taskGame: GameEntity;
}
export class EditTaskDTO {
@IsUUID('4')
taskId: string;
@IsUUID('4')
taskWinner: FactionEntity;
@IsUUID('4')
taskGame: GameEntity;
}
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