Skip to content
Snippets Groups Projects
game.dto.ts 1.92 KiB
Newer Older
import { IsNotEmpty, IsString, IsDate, Length, IsInt, Min, Max, IsArray, IsJSON } from 'class-validator';
import { Timestamp } from 'typeorm';
L4072's avatar
L4072 committed

L4072's avatar
L4072 committed
export class GameDTO {
    @IsString() @IsNotEmpty() @Length(3, 30)
L4072's avatar
L4072 committed
    name: string;

    @IsString()
    gameDescription?: string;

    @IsDate() @IsNotEmpty()
    startDate: string;

    @IsDate() @IsNotEmpty()
    endDate: string;

    @IsArray() @IsNotEmpty()
    factions?: FactionDTO[];

    @IsArray() @IsNotEmpty()
    objectivePoint?: ObjectivePointDTO[];

    @IsJSON() @IsNotEmpty()
    mapCoordinates: JSON;

}

/*export class EditGameDTO {
    @IsString() @IsNotEmpty() @Length(3, 30)
    gameName?: string;

    @IsString()
    gameDescription?: string;

    @IsDate() @IsNotEmpty()
    startDate: string;

    @IsDate() @IsNotEmpty()
    endDate: string;

    @IsArray() @IsNotEmpty()
    factions?: FactionDTO[];

    @IsArray() @IsNotEmpty()
    objectivePoint?: ObjectivePointDTO[];

    @IsJSON() @IsNotEmpty()
    mapCoordinates: JSON;

    @IsString() @IsNotEmpty() @Length(3, 255)
    GM_Password?: string;
}*/
export class FactionDTO {
    @IsString() @IsNotEmpty() @Length(3, 30)
    factionName: string;

    @IsString() @IsNotEmpty() @Length(3, 255)
    faction_Password?: string;
L4072's avatar
L4072 committed
/*export class PowerUpDTO {
    @IsString() @IsNotEmpty()
    powerUpName: string;

    @IsString() @IsNotEmpty()
    powerUpDescription?: string;

    @IsInt() @IsNotEmpty()
    amount: number;

    @IsNotEmpty()
    cooldown: string;
L4072's avatar
L4072 committed
}*/

export class ObjectivePointDTO {
    @IsString() @IsNotEmpty()
    objectivePointDescription: string;

    @IsJSON() @IsNotEmpty()
    objectivePointCoordinates: JSON;

    @IsArray() @IsNotEmpty()
    objectivePointHistory: ObjectivePointHistoryDTO[];
}

export class ObjectivePointHistoryDTO {
    @IsString() 
    factionId: string;

    @IsNotEmpty() @IsInt() @Min(0) @Max(2)
    oP_HistoryStatus: number;

    @IsNotEmpty()
    oP_HistoryTimestamp: Timestamp;
}