diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-10-14 19:47:02 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-10-14 19:47:02 +0200 |
commit | 9200fb546c1e2c12e0403a1bbfb6360946a28b1c (patch) | |
tree | 41d3730d3aa235002a844e753b27ad2a74afbce7 /util/src/entities/StickerPack.ts | |
parent | :sparkles: sticker packs (diff) | |
download | server-9200fb546c1e2c12e0403a1bbfb6360946a28b1c.tar.xz |
:sparkles: sticker db entities
Diffstat (limited to 'util/src/entities/StickerPack.ts')
-rw-r--r-- | util/src/entities/StickerPack.ts | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/util/src/entities/StickerPack.ts b/util/src/entities/StickerPack.ts new file mode 100644 index 00000000..b80fa9c7 --- /dev/null +++ b/util/src/entities/StickerPack.ts @@ -0,0 +1,31 @@ +import { Column, Entity, JoinColumn, OneToMany, OneToOne, RelationId } from "typeorm"; +import { Sticker } from "."; +import { BaseClass } from "./BaseClass"; + +@Entity("stickers") +export class StickerPack extends BaseClass { + @Column() + name: string; + + @Column({ nullable: true }) + description?: string; + + @Column({ nullable: true }) + banner_asset_id?: string; + + @OneToMany(() => Sticker, (sticker: Sticker) => sticker.pack_id, { + cascade: true, + orphanedRowAction: "delete", + }) + stickers: Sticker[]; + + // sku_id: string + + @Column({ nullable: true }) + @RelationId((pack: StickerPack) => pack.cover_sticker) + cover_sticker_id?: string; + + @OneToOne(() => Sticker, { nullable: true }) + @JoinColumn() + cover_sticker?: Sticker; +} |