unoffical wafrn mirror wafrn.net
atproto social-network activitypub
at testPDSNotExplode 82 lines 1.6 kB view raw
1import { Model, Table, Column, DataType, ForeignKey, BelongsTo } from 'sequelize-typescript' 2import { Post } from './post.js' 3import { User } from './user.js' 4 5export interface AskAttributes { 6 id?: number 7 createdAt?: Date 8 updatedAt?: Date 9 question?: string 10 apObject?: string | null 11 creationIp?: string 12 answered?: boolean 13 postId?: string | null 14 userAsked?: string 15 userAsker?: string 16} 17 18@Table({ 19 tableName: 'asks', 20 modelName: 'asks', 21 timestamps: true, 22 defaultScope: { 23 attributes: { 24 exclude: ['creationIp'] 25 } 26 } 27}) 28export class Ask extends Model<AskAttributes, AskAttributes> implements AskAttributes { 29 @Column({ 30 allowNull: true, 31 type: DataType.STRING 32 }) 33 declare question: string 34 35 @Column({ 36 allowNull: true, 37 type: DataType.STRING 38 }) 39 declare apObject: string | null 40 41 @Column({ 42 allowNull: true, 43 type: DataType.STRING(255) 44 }) 45 declare creationIp: string 46 47 @Column({ 48 allowNull: true, 49 type: DataType.BOOLEAN 50 }) 51 declare answered: boolean 52 53 @ForeignKey(() => Post) 54 @Column({ 55 allowNull: true, 56 type: DataType.UUID 57 }) 58 declare postId: string | null 59 60 @ForeignKey(() => User) 61 @Column({ 62 allowNull: true, 63 type: DataType.UUID 64 }) 65 declare userAsked: string 66 67 @ForeignKey(() => User) 68 @Column({ 69 allowNull: true, 70 type: DataType.UUID 71 }) 72 declare userAsker: string 73 74 @BelongsTo(() => Post, 'postId') 75 declare post: Post 76 77 @BelongsTo(() => User, 'userAsked') 78 declare userAskedUser: User 79 80 @BelongsTo(() => User, 'userAsker') 81 declare userAskerUser: User 82}