Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
faction.dto.ts 940 B
import {
  IsUUID,
  Length,
  Validate,
  IsString,
  IsNotEmpty,
} from 'class-validator';

import { GameEntity } from '../game/game.entity';
import { RoleValidation } from '../shared/custom-validation';
import { GameDTO } from '../game/game.dto';
import { FactionEntity, GameGroupEntity } from './faction.entity';

export class FactionDTO {
  @IsString()
  @IsNotEmpty()
  @Length(2, 15)
  factionName: string;
  factionPassword: string;
  multiplier?: number;
  game: GameDTO;
}

export class JoinFactionDTO {
  @IsUUID('4')
  factionId: string;
  @Length(3, 31)
  factionPassword: string;
  @IsUUID('4')
  game: GameEntity;
}

export class PromotePlayerDTO {
  @IsUUID('4')
  player: string;
  @Validate(RoleValidation)
  role: string;
}

export class GameGroupDTO {
  @IsString()
  @Length(3, 31)
  name: string;
  @IsUUID('4')
  faction: FactionEntity;
}

export class JoinGameGroupDTO {
  @IsUUID('4')
  groupId: GameGroupEntity;
}