unoffical wafrn mirror
wafrn.net
atproto
social-network
activitypub
1import {
2 Model, Table, Column, DataType, ForeignKey, BelongsTo
3} from "sequelize-typescript";
4import { User } from "./user.js";
5import { Post } from "./post.js";
6import { EmojiReaction } from "./emojiReaction.js";
7
8export interface NotificationAttributes {
9 id?: number;
10 createdAt?: Date;
11 updatedAt?: Date;
12 notificationType?: string;
13 notifiedUserId?: string;
14 userId?: string;
15 postId?: string | null;
16 emojiReactionId?: string;
17}
18
19@Table({
20 tableName: "notifications",
21 modelName: "notifications",
22 timestamps: true
23})
24export class Notification extends Model<NotificationAttributes, NotificationAttributes> implements NotificationAttributes {
25 @Column({
26 allowNull: true,
27 type: DataType.STRING(128)
28 })
29 declare notificationType: string;
30
31 @ForeignKey(() => User)
32 @Column({
33 allowNull: true,
34 type: DataType.UUID
35 })
36 declare notifiedUserId: string;
37
38 @ForeignKey(() => User)
39 @Column({
40 allowNull: true,
41 type: DataType.UUID
42 })
43 declare userId: string;
44
45 @ForeignKey(() => Post)
46 @Column({
47 allowNull: true,
48 type: DataType.UUID
49 })
50 declare postId: string | null;
51
52 @ForeignKey(() => EmojiReaction)
53 @Column({
54 allowNull: true,
55 type: DataType.UUID
56 })
57 declare emojiReactionId: string;
58
59 @BelongsTo(() => User, "userId")
60 declare user: User;
61
62 @BelongsTo(() => User, "notifiedUserId")
63 declare notifiedUser: User;
64
65 @BelongsTo(() => Post, "postId")
66 declare post: Post;
67
68 @BelongsTo(() => EmojiReaction, "emojiReactionId")
69 declare emojiReaction: EmojiReaction;
70}