diff --git a/server/entities/game.ts b/server/entities/game.ts index 71e5cfdb7..8c0944b6f 100644 --- a/server/entities/game.ts +++ b/server/entities/game.ts @@ -10,7 +10,7 @@ import { JoinColumn, } from 'typeorm'; -import type { Game as GameInterface } from '../../types/game.type'; +import { GameStatus, type Game as GameInterface } from '../../types/game.type'; import { Activity } from './activity'; import { GameResponse } from './gameResponse'; import { User } from './user'; @@ -67,4 +67,11 @@ export class Game implements GameInterface { @Column({ type: 'text' }) public video: string; + + @Column({ + type: 'tinyint', + nullable: false, + default: GameStatus.VALIDATED, + }) + public status: number; } diff --git a/server/migrations/1724946964960-AlterGameTable.ts b/server/migrations/1724946964960-AlterGameTable.ts new file mode 100644 index 000000000..5da256277 --- /dev/null +++ b/server/migrations/1724946964960-AlterGameTable.ts @@ -0,0 +1,11 @@ +import type { MigrationInterface, QueryRunner } from 'typeorm'; + +export class AlterGameTable1724946964960 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE game ADD COLUMN status INT NOT NULL DEFAULT (1)`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE game DROP COLUMN status`); + } +} diff --git a/types/game.type.ts b/types/game.type.ts index 17e5bb650..fac01a8eb 100644 --- a/types/game.type.ts +++ b/types/game.type.ts @@ -51,6 +51,11 @@ export enum methodType { CURRENCY = 'currency', } +export const GameStatus = { + DRAFT: 0, + VALIDATED: 1, +}; + // export interface Game export interface Game { id: number; @@ -66,6 +71,7 @@ export interface Game { origine?: string; signification: string; video: string; + status: number; } export type GamesData = {