unoffical wafrn mirror
wafrn.net
atproto
social-network
activitypub
1import {
2 Model, Table, Column, DataType, ForeignKey, BelongsTo,
3 HasMany
4} from "sequelize-typescript";
5import { Post } from "./post.js";
6import { QuestionPollQuestion } from "./questionPollQuestion.js";
7import { HasManyGetAssociationsMixin } from "sequelize";
8
9export interface QuestionPollsAttributes {
10 id?: number;
11 createdAt?: Date;
12 updatedAt?: Date;
13 endDate?: Date;
14 multiChoice?: boolean;
15 postId?: string;
16}
17
18@Table({
19 tableName: "questionPolls",
20 modelName: "questionPolls",
21 timestamps: true
22})
23export class QuestionPoll extends Model<QuestionPollsAttributes, QuestionPollsAttributes> implements QuestionPollsAttributes {
24 @Column({
25 allowNull: true,
26 type: DataType.DATE
27 })
28 declare endDate: Date;
29
30 @Column({
31 allowNull: true,
32 type: DataType.BOOLEAN
33 })
34 declare multiChoice: boolean;
35
36 @ForeignKey(() => Post)
37 @Column({
38 allowNull: true,
39 type: DataType.UUID
40 })
41 declare postId: string;
42
43 @BelongsTo(() => Post, "postId")
44 declare post: Post;
45
46 @HasMany(() => QuestionPollQuestion)
47 declare questionPollQuestions: QuestionPollQuestion[]
48 declare getQuestionPollQuestions: HasManyGetAssociationsMixin<QuestionPollQuestion>
49}