summary refs log tree commit diff
path: root/util/src/entities/Sticker.ts
diff options
context:
space:
mode:
Diffstat (limited to 'util/src/entities/Sticker.ts')
-rw-r--r--util/src/entities/Sticker.ts36
1 files changed, 29 insertions, 7 deletions
diff --git a/util/src/entities/Sticker.ts b/util/src/entities/Sticker.ts

index ab224d1d..37bc6fbe 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"; @@ -8,6 +9,7 @@ export enum StickerType { } export enum StickerFormatType { + GIF = 0, // gif is a custom format type and not in discord spec PNG = 1, APNG = 2, LOTTIE = 3, @@ -21,11 +23,22 @@ export class Sticker extends BaseClass { @Column({ nullable: true }) description?: string; - @Column() - tags: string; + @Column({ nullable: true }) + available?: boolean; - @Column() - pack_id: string; + @Column({ nullable: true }) + tags?: string; + + @Column({ nullable: true }) + @RelationId((sticker: Sticker) => sticker.pack) + pack_id?: string; + + @JoinColumn({ name: "pack_id" }) + @ManyToOne(() => require("./StickerPack").StickerPack, { + onDelete: "CASCADE", + nullable: true, + }) + pack: import("./StickerPack").StickerPack; @Column({ nullable: true }) guild_id?: string; @@ -36,9 +49,18 @@ export class Sticker extends BaseClass { }) guild?: Guild; - @Column({ type: "simple-enum", enum: StickerType }) + @Column({ nullable: true }) + user_id?: string; + + @JoinColumn({ name: "user_id" }) + @ManyToOne(() => User, { + onDelete: "CASCADE", + }) + user?: User; + + @Column({ type: "int" }) type: StickerType; - @Column({ type: "simple-enum", enum: StickerFormatType }) + @Column({ type: "int" }) format_type: StickerFormatType; }