Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(vil-606): add new column status in table game #994

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion server/entities/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
}
11 changes: 11 additions & 0 deletions server/migrations/1724946964960-AlterGameTable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { MigrationInterface, QueryRunner } from 'typeorm';

export class AlterGameTable1724946964960 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE game ADD COLUMN status INT NOT NULL DEFAULT (1)`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE game DROP COLUMN status`);
}
}
6 changes: 6 additions & 0 deletions types/game.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ export enum methodType {
CURRENCY = 'currency',
}

export const GameStatus = {
DRAFT: 0,
VALIDATED: 1,
};

// export interface Game
export interface Game {
id: number;
Expand All @@ -66,6 +71,7 @@ export interface Game {
origine?: string;
signification: string;
video: string;
status: number;
}

export type GamesData = {
Expand Down
Loading