import Column from "@entity-access/entity-access/dist/decorators/Column.js"; import { RelateTo } from "@entity-access/entity-access/dist/decorators/Relate.js"; import Table from "@entity-access/entity-access/dist/decorators/Table.js"; import Mailbox from "./Mailbox.js"; import { Email } from "./Email.js"; import DateTime from "@entity-access/entity-access/dist/types/DateTime.js"; import MailboxContact from "./MailboxContact.js"; import Index from "@entity-access/entity-access/dist/decorators/Index.js"; import MultiForeignKeys from "@entity-access/entity-access/dist/decorators/ForeignKey.js"; @Table("MailboxContactEvents") @Index({ name: "IX_Mailbox_Contact_Events_StartDate", columns: [ { name: (x) => x.mailboxID , descending: false }, { name: (x) => x.startDate , descending: false }, ] }) @Index({ name: "IX_Mailbox_Contact_Events_Contacts", columns: [ { name: (x) => x.mailboxID , descending: false }, { name: (x) => x.emailAddressID , descending: false }, { name: (x) => x.startDate , descending: false }, ] }) export default class MailboxContactEvent { @Column({ dataType: "BigInt" , generated: "identity", key: true}) eventID: number; @Column({ dataType: "BigInt" }) @RelateTo(Mailbox, { property: (x) => x.mailbox, inverseProperty: (x) => x.mailboxEvents, foreignKeyConstraint: { name: "FC_MailboxEvent_Mailbox", onDelete: "cascade" } }) mailboxID: number; @Column({ dataType: "BigInt"}) emailAddressID: number; @Column({ dataType: "BigInt", nullable: true}) @RelateTo(Email, { property: (x) => x.email, inverseProperty: (x) => x.mailboxContactEvents, foreignKeyConstraint: { name: "FC_MailboxEvents_EmailID", onDelete: "cascade" } }) emailID: number; @Column({ dataType: "DateTime" }) startDate: DateTime; @Column({ dataType: "DateTime" }) endDate: DateTime; @Column({ dataType: "Char", length: 200, nullable: true }) title: string; @Column({ dataType: "Char", length: 400, nullable: true }) description: string; @Column({ dataType: "Char", length: 400, nullable: true }) location: string; mailbox: Mailbox; @MultiForeignKeys(MailboxContact, { foreignKeys: [ { foreignKey: (x) => x.mailboxID, key: (x) => x.mailboxID}, { foreignKey: (x) => x.emailAddressID, key: (x) => x.emailAddressID} ], inverseProperty: (x) => x.contactEvents }) mailboxContact: MailboxContact; email: Email; }