idk what this is

This commit is contained in:
2025-01-13 18:43:25 +01:00
parent a32faaee08
commit 9ab476bbbd
3 changed files with 41 additions and 1 deletions
+2
View File
@@ -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,
+15 -1
View File
@@ -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[]>;
}