Template
idk what this is
This commit is contained in:
@@ -16,6 +16,7 @@ import { Message } from './games/entities/message.entity';
|
||||
import { LobbyModule } from './lobby/lobby.module';
|
||||
import { Concept } from './concept/entities/concept.entity';
|
||||
import { ConceptModule } from './concept/concept.module';
|
||||
import { ConceptType } from './concept/entities/concepttype.entity';
|
||||
|
||||
const configService = new ConfigService();
|
||||
|
||||
@@ -40,6 +41,7 @@ const configService = new ConfigService();
|
||||
Game,
|
||||
Message,
|
||||
Concept,
|
||||
ConceptType,
|
||||
ConceptInTurn,
|
||||
Topic,
|
||||
Word,
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
import { Column, Entity, PrimaryGeneratedColumn, Unique } from 'typeorm';
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
ManyToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
Unique,
|
||||
} from 'typeorm';
|
||||
import { ConceptType } from './concepttype.entity';
|
||||
|
||||
@Entity()
|
||||
@Unique(['value'])
|
||||
@@ -11,4 +18,11 @@ export class Concept {
|
||||
|
||||
@Column({ default: false })
|
||||
enabled: boolean;
|
||||
|
||||
@ManyToOne(() => ConceptType, {
|
||||
eager: true,
|
||||
nullable: true,
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
type: ConceptType;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
OneToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
Unique,
|
||||
} from 'typeorm';
|
||||
import { Concept } from './concept.entity';
|
||||
|
||||
@Entity()
|
||||
@Unique(['value'])
|
||||
export class ConceptType {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@Column()
|
||||
value: string;
|
||||
|
||||
@OneToMany(() => Concept, (concept) => concept.type, {
|
||||
lazy: true,
|
||||
orphanedRowAction: 'delete',
|
||||
})
|
||||
concepts: Promise<Concept[]>;
|
||||
}
|
||||
Reference in New Issue
Block a user