3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00
zeppelin/backend/src/data/entities/ScheduledPost.ts
Dragory 2f50232cf3
Fix TypeORM errors for nullable fields
For fields with '| null' in the TS type, the column type needs to be
specified explicitly in column options when using MySQL.

See:
https://github.com/typeorm/typeorm/issues/1358#issuecomment-391736766
2020-11-09 20:12:16 +02:00

35 lines
885 B
TypeScript

import { Column, Entity, PrimaryColumn } from "typeorm";
import { Attachment } from "eris";
import { StrictMessageContent } from "../../utils";
@Entity("scheduled_posts")
export class ScheduledPost {
@Column()
@PrimaryColumn()
id: number;
@Column() guild_id: string;
@Column() author_id: string;
@Column() author_name: string;
@Column() channel_id: string;
@Column("simple-json") content: StrictMessageContent;
@Column("simple-json") attachments: Attachment[];
@Column({ type: String, nullable: true }) post_at: string | null;
/**
* How often to post the message, in milliseconds
*/
@Column({ type: String, nullable: true }) repeat_interval: number | null;
@Column({ type: String, nullable: true }) repeat_until: string | null;
@Column({ type: String, nullable: true }) repeat_times: number | null;
@Column() enable_mentions: boolean;
}