import { Column, ColumnType, Entity, OneToMany, PrimaryColumn } from "typeorm"; import { protocolAgenda } from "./protocolAgenda"; import { protocolDecision } from "./protocolDecision"; import { protocolPresence } from "./protocolPresence"; import { protocolPrintout } from "./protocolPrintout"; import { protocolVoting } from "./protocolVoting"; import { getTypeByORM } from "../../../migrations/ormHelper"; @Entity() export class protocol { @PrimaryColumn({ generated: "increment", type: "int" }) id: number; @Column({ type: "varchar", length: 255, unique: true }) title: string; @Column({ type: getTypeByORM("date").type as ColumnType }) date: Date; @Column({ type: getTypeByORM("time").type as ColumnType, nullable: true }) starttime: Date; @Column({ type: getTypeByORM("time").type as ColumnType, nullable: true }) endtime: Date; @Column({ type: "text", nullable: true }) summary: string; @OneToMany(() => protocolAgenda, (agenda) => agenda.protocol, { cascade: ["insert"] }) agendas: protocolAgenda[]; @OneToMany(() => protocolDecision, (decision) => decision.protocol, { cascade: ["insert"] }) decisions: protocolDecision[]; @OneToMany(() => protocolPresence, (presence) => presence.protocol, { cascade: ["insert"] }) presences: protocolPresence[]; @OneToMany(() => protocolPrintout, (printout) => printout.protocol, { cascade: ["insert"] }) printouts: protocolPrintout[]; @OneToMany(() => protocolVoting, (voting) => voting.protocol, { cascade: ["insert"] }) votings: protocolVoting[]; }