unoffical wafrn mirror wafrn.net
atproto social-network activitypub
at development 56 lines 1.2 kB view raw
1import { 2 Model, Table, Column, DataType, ForeignKey, BelongsTo 3} from "sequelize-typescript"; 4import { User } from "./user.js"; 5import { Post } from "./post.js"; 6 7export interface UserLikesPostRelationsAttributes { 8 id?: number; 9 createdAt?: Date; 10 updatedAt?: Date; 11 userId: string; 12 postId: string; 13 remoteId?: string; 14 bskyPath?: string; 15} 16 17@Table({ 18 tableName: "userLikesPostRelations", 19 modelName: "userLikesPostRelations", 20 timestamps: true 21}) 22export class UserLikesPostRelations extends Model<UserLikesPostRelationsAttributes, UserLikesPostRelationsAttributes> implements UserLikesPostRelationsAttributes { 23 24 @ForeignKey(() => User) 25 @Column({ 26 primaryKey: true, 27 type: DataType.UUID 28 }) 29 declare userId: string; 30 31 @ForeignKey(() => Post) 32 @Column({ 33 primaryKey: true, 34 type: DataType.UUID 35 }) 36 declare postId: string; 37 38 @Column({ 39 allowNull: true, 40 type: DataType.STRING(768) 41 }) 42 declare remoteId: string; 43 44 @Column({ 45 allowNull: true, 46 type: DataType.STRING(768) 47 }) 48 declare bskyPath: string; 49 50 @BelongsTo(() => User, "userId") 51 declare user: User; 52 53 @BelongsTo(() => Post, "postId") 54 declare post: Post; 55 56}