unoffical wafrn mirror
wafrn.net
atproto
social-network
activitypub
1import { Model, Table, Column, DataType, HasMany, BelongsToMany } from 'sequelize-typescript'
2import { User } from './user.js'
3import { Post } from './post.js'
4import { PostHostView } from './postHostView.js'
5import { ServerBlock } from './serverBlock.js'
6
7export interface FederatedHostAttributes {
8 id?: string
9 createdAt?: Date
10 updatedAt?: Date
11 displayName?: string
12 publicInbox?: string | null
13 publicKey?: string
14 detail?: string
15 blocked?: boolean
16 friendServer?: boolean
17 bubbleTimeline?: boolean
18}
19
20@Table({
21 tableName: 'federatedHosts',
22 modelName: 'federatedHosts',
23 timestamps: true
24})
25export class FederatedHost
26 extends Model<FederatedHostAttributes, FederatedHostAttributes>
27 implements FederatedHostAttributes
28{
29 @Column({
30 primaryKey: true,
31 type: DataType.UUID,
32 defaultValue: DataType.UUIDV4
33 })
34 declare id: string
35
36 @Column({
37 allowNull: true,
38 type: DataType.STRING
39 })
40 declare displayName: string
41
42 @Column({
43 allowNull: true,
44 type: DataType.STRING
45 })
46 declare publicInbox: string | null
47
48 @Column({
49 allowNull: true,
50 type: DataType.STRING
51 })
52 declare publicKey: string
53
54 @Column({
55 allowNull: true,
56 type: DataType.STRING(255)
57 })
58 declare detail: string
59
60 @Column({
61 allowNull: true,
62 type: DataType.BOOLEAN,
63 defaultValue: false
64 })
65 declare blocked: boolean
66
67 @Column({
68 allowNull: true,
69 type: DataType.BOOLEAN,
70 defaultValue: false
71 })
72 declare friendServer: boolean
73
74 @Column({
75 allowNull: true,
76 type: DataType.BOOLEAN,
77 defaultValue: false
78 })
79 declare bubbleTimeline: boolean
80
81 @HasMany(() => User)
82 declare users: User[]
83
84 @BelongsToMany(() => Post, () => PostHostView)
85 declare postView: Post[]
86
87 @HasMany(() => ServerBlock)
88 declare blockedServer: ServerBlock[]
89}