diff options
Diffstat (limited to 'util/src/entities/Sticker.ts')
-rw-r--r-- | util/src/entities/Sticker.ts | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/util/src/entities/Sticker.ts b/util/src/entities/Sticker.ts index 036ff2d0..94761f60 100644 --- a/util/src/entities/Sticker.ts +++ b/util/src/entities/Sticker.ts @@ -1,4 +1,5 @@ -import { Column, Entity, JoinColumn, ManyToOne } from "typeorm"; +import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm"; +import { User } from "./User"; import { BaseClass } from "./BaseClass"; import { Guild } from "./Guild"; @@ -25,8 +26,15 @@ export class Sticker extends BaseClass { tags: string; @Column() + @RelationId((sticker: Sticker) => sticker.pack) pack_id: string; + @JoinColumn({ name: "pack_id" }) + @ManyToOne(() => require("./StickerPack").StickerPack, { + onDelete: "CASCADE", + }) + pack: import("./StickerPack").StickerPack; + @Column({ nullable: true }) guild_id?: string; @@ -36,6 +44,15 @@ export class Sticker extends BaseClass { }) guild?: Guild; + @Column({ nullable: true }) + user_id?: string; + + @JoinColumn({ name: "user_id" }) + @ManyToOne(() => User, { + onDelete: "CASCADE", + }) + user?: User; + @Column({ type: "int" }) type: StickerType; |