unoffical wafrn mirror
wafrn.net
atproto
social-network
activitypub
1import { Model, Table, Column, DataType, ForeignKey, BelongsTo, HasMany } from "sequelize-typescript";
2import { Emoji } from "./emoji.js";
3import { User } from "./user.js";
4import { Post } from "./post.js";
5import { Notification } from "./notification.js";
6import { defaultValueSchemable } from "sequelize/lib/utils";
7
8export interface EmojiReactionAttributes {
9 id?: string;
10 createdAt?: Date;
11 updatedAt?: Date;
12 remoteId?: string;
13 content?: string;
14 postId?: string;
15 userId?: string;
16 emojiId?: string;
17}
18
19@Table({
20 tableName: "emojiReactions",
21 modelName: "emojiReactions",
22 timestamps: true
23})
24export class EmojiReaction extends Model<EmojiReactionAttributes, EmojiReactionAttributes> implements EmojiReactionAttributes {
25
26 @Column({
27 primaryKey: true,
28 type: DataType.UUID,
29 defaultValue: DataType.UUIDV4
30 })
31 declare id: string;
32
33 @Column({
34 allowNull: true,
35 type: DataType.STRING(768)
36 })
37 declare remoteId: string;
38
39 @Column({
40 allowNull: true,
41 type: DataType.STRING(768)
42 })
43 declare content: string;
44
45 @ForeignKey(() => Post)
46 @Column({
47 allowNull: true,
48 type: DataType.UUID
49 })
50 declare postId: string;
51
52 @ForeignKey(() => User)
53 @Column({
54 allowNull: true,
55 type: DataType.UUID
56 })
57 declare userId: string;
58
59 @ForeignKey(() => Emoji)
60 @Column({
61 allowNull: true,
62 type: DataType.STRING(255)
63 })
64 declare emojiId: string;
65
66 @BelongsTo(() => Post, "postId")
67 declare post: Post
68
69 @BelongsTo(() => User, "userId")
70 declare user: Post
71
72 @BelongsTo(() => Emoji, "emojiId")
73 declare emoji: Post
74
75 @HasMany(() => Notification)
76 declare notifications: Notification[];
77}