fix: insignia relations

This commit is contained in:
Methapon2001 2024-03-18 18:03:01 +07:00
parent 8339c55472
commit b0292f3921
4 changed files with 74 additions and 186 deletions

View file

@ -1,6 +1,8 @@
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { InsigniaType } from "./InsigniaType";
import { ProfileInsignia } from "./ProfileInsignia";
import { ProfileInsigniaHistory } from "./ProfileInsigniaHistory";
@Entity("insignia")
export class Insignia extends EntityBase {
@ -50,6 +52,14 @@ export class Insignia extends EntityBase {
@ManyToOne(() => InsigniaType, (insigniaType) => insigniaType.insignias)
@JoinColumn({ name: "insigniaTypeId" })
insigniaType: InsigniaType;
@OneToMany(() => ProfileInsignia, (v) => v.insignia)
@JoinColumn({ name: "insigniaId" })
profileInsignias: ProfileInsignia;
@OneToMany(() => ProfileInsigniaHistory, (v) => v.insignia)
@JoinColumn({ name: "insigniaHistoryId" })
profileInsigniaHistories: ProfileInsigniaHistory;
}
export class CreateInsignias {