game workflow corrected
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, ManyToOne, JoinColumn } from 'typeorm';
|
||||
import { Consequence, CardType } from '../Deck/DeckAggregate';
|
||||
import { UserAggregate } from '../User/UserAggregate';
|
||||
import { OrganizationAggregate } from '../Organization/OrganizationAggregate';
|
||||
|
||||
export enum GameState {
|
||||
WAITING = 0,
|
||||
@@ -65,14 +67,8 @@ export class GameAggregate {
|
||||
@Column({ type: 'uuid', array: true, default: () => "'{}'", name: 'playerids' })
|
||||
players!: string[];
|
||||
|
||||
@Column({ type: 'boolean', default: false })
|
||||
started!: boolean;
|
||||
|
||||
@Column({ type: 'boolean', default: false })
|
||||
finished!: boolean;
|
||||
|
||||
@Column({ type: 'uuid', nullable: true, name: 'winnerid' })
|
||||
winner!: string | null;
|
||||
@Column({ type: 'uuid', nullable: true, name: 'winnerId' })
|
||||
winnerId!: string | null;
|
||||
|
||||
@Column({ type: 'int', default: GameState.WAITING })
|
||||
state!: GameState;
|
||||
@@ -86,8 +82,20 @@ export class GameAggregate {
|
||||
@Column({ type: 'timestamp', nullable: true, name: 'finishDate' })
|
||||
enddate!: Date | null;
|
||||
|
||||
@UpdateDateColumn()
|
||||
@UpdateDateColumn({ name: 'updateDate' })
|
||||
updateDate!: Date;
|
||||
|
||||
@ManyToOne(() => UserAggregate, { eager: false })
|
||||
@JoinColumn({ name: 'createdBy' })
|
||||
user!: UserAggregate | null;
|
||||
|
||||
@ManyToOne(() => UserAggregate, { eager: false })
|
||||
@JoinColumn({ name: 'winnerId' })
|
||||
winner!: UserAggregate | null;
|
||||
|
||||
@ManyToOne(() => OrganizationAggregate, { eager: false })
|
||||
@JoinColumn({ name: 'organizationId' })
|
||||
organization!: OrganizationAggregate | null;
|
||||
}
|
||||
|
||||
// Board Generation Types
|
||||
|
||||
Reference in New Issue
Block a user