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 { import {
IsString, IsString,
Length, Length,
IsNumber,
IsBoolean, IsBoolean,
Min, Validate,
Max, IsUUID,
Equals,
} from 'class-validator'; } 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() @IsString()
@Length(3, 31) @Length(3, 31)
taskName: string; taskName: string;
@IsString() @IsString()
@Length(0, 255) @Length(0, 255)
taskDescription: string; taskDescription: string;
@IsNumber()
@Min(1)
@Max(99)
taskScore: number;
@IsString()
@Length(3, 31)
taskWinner?: string;
@IsBoolean() @IsBoolean()
taskIsActive: boolean; taskIsActive: boolean;
// faction unique id @Validate(Uuid)
@IsString()
faction: FactionEntity; 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