unoffical wafrn mirror
wafrn.net
atproto
social-network
activitypub
1import { Model, Table, Column, DataType, ForeignKey, BelongsTo } from 'sequelize-typescript'
2import { User } from './user.js'
3
4export interface BlocksAttributes {
5 id?: number
6 createdAt?: Date
7 updatedAt?: Date
8 remoteBlockId?: string
9 reason?: string
10 blockedId: string
11 blockerId: string
12 bskyPath?: string
13}
14
15@Table({
16 tableName: 'blocks',
17 modelName: 'blocks',
18 timestamps: true
19})
20export class Blocks extends Model<BlocksAttributes, BlocksAttributes> implements BlocksAttributes {
21 @Column({
22 allowNull: true,
23 type: DataType.STRING(768)
24 })
25 declare bskyPath: string
26
27 @Column({
28 allowNull: true,
29 type: DataType.STRING(768)
30 })
31 declare remoteBlockId: string
32
33 @Column({
34 allowNull: true,
35 type: DataType.STRING
36 })
37 declare reason: string
38
39 @ForeignKey(() => User)
40 @Column({
41 primaryKey: true,
42 type: DataType.UUID
43 })
44 declare blockedId: string
45
46 @ForeignKey(() => User)
47 @Column({
48 primaryKey: true,
49 type: DataType.UUID
50 })
51 declare blockerId: string
52
53 @BelongsTo(() => User, 'blockedId')
54 declare blocked: User
55
56 @BelongsTo(() => User, 'blockerId')
57 declare blocker: User
58}