import { Column, Entity, ManyToOne, PrimaryColumn, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn, AfterUpdate, BeforeUpdate, ColumnType, } from "typeorm"; import { calendarType } from "../settings/calendarType"; import { getTypeByORM } from "../../migrations/ormHelper"; @Entity() export class calendar { @PrimaryGeneratedColumn("uuid") id: string; @Column({ type: getTypeByORM("datetime").type as ColumnType }) starttime: Date; @Column({ type: getTypeByORM("datetime").type as ColumnType }) endtime: Date; @Column({ type: "varchar", length: 255, nullable: false }) title: string; @Column({ type: "text", nullable: true }) content: string; @Column({ type: "text", nullable: true }) location: string; @Column({ type: "boolean", default: false }) allDay: boolean; @Column({ type: "int", default: 1 }) sequence: number; @CreateDateColumn() createdAt: Date; @UpdateDateColumn() updatedAt: Date; @Column({ type: "varchar", nullable: true, default: null, unique: true }) webpageId: string; @ManyToOne(() => calendarType, (t) => t.calendar, { nullable: false, onDelete: "RESTRICT", onUpdate: "RESTRICT", cascade: ["insert"], }) type: calendarType; }