summary refs log tree commit diff
path: root/util/src/entities/Sticker.ts
diff options
context:
space:
mode:
authorSamuel <34555296+Flam3rboy@users.noreply.github.com>2021-10-15 18:39:57 +0200
committerGitHub <noreply@github.com>2021-10-15 18:39:57 +0200
commit0c811dbee9b960b7b1ef28a85ff79e86672af856 (patch)
treea25db8eb098d5651df8228911bc01716abef1cf6 /util/src/entities/Sticker.ts
parentMerge pull request #462 from hbjydev/unit-tests-expanded (diff)
parent:sparkles: sticker events (diff)
downloadserver-0c811dbee9b960b7b1ef28a85ff79e86672af856.tar.xz
Merge pull request #455 from fosscord/sticker
Stickers
Diffstat (limited to '')
-rw-r--r--util/src/entities/Sticker.ts32
1 files changed, 27 insertions, 5 deletions
diff --git a/util/src/entities/Sticker.ts b/util/src/entities/Sticker.ts

index 036ff2d0..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,6 +49,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;