import Column from "@entity-access/entity-access/dist/decorators/Column.js"; import Index from "@entity-access/entity-access/dist/decorators/Index.js"; import Table from "@entity-access/entity-access/dist/decorators/Table.js"; import type { HostedDomain } from "./HostedDomain.js"; import type EmailAddress from "./EmailAddress.js"; import { ContactDomain } from "./Contact.js"; import type ServerActivity from "./ServerActivity.js"; import type Mailbox from "./Mailbox.js"; import type HostedZone from "./HostedZone.js"; import type SubscriptionDomain from "./SubscriptionDomain.js"; import DateTime from "@entity-access/entity-access/dist/types/DateTime.js"; @Table("Domains") @Index({ name: "IX_Unique_Domains_V2", dropNames:["IX_Unique_Domains"], unique: true, columns: [{ name: (x) => x.name, descending: false, operatorClass: "varchar_pattern"}] }) @Index({ name: "IX_Domains_SMTP_Not_Available_Till", columns: [ { name: (x) => x.smtpNotAvailableTill, descending: false } ], filter: (x) => x.smtpNotAvailableTill !== null }) @Index({ name: "IX_Domains_Pause_Smtp_Till", columns: [ { name: (x) => x.pauseSendingTill, descending: false } ], filter: (x) => x.pauseSendingTill !== null }) export default class Domain { @Column({ key: true, generated: "identity" }) public domainID: number; @Column({ length: 200, dataType: "Char"}) public name: string; @Column({ dataType: "Int", default: () => 0}) received: number ; @Column({ dataType: "Int", default: () => 0}) failed: number ; @Column({ dataType: "Boolean", default: () => false}) whiteListed: boolean; @Column({ dataType: "DateTime", nullable: true}) pauseSendingTill: DateTime; @Column({ dataType: "DateTime", nullable: true}) smtpNotAvailableTill: DateTime; @Column({ dataType: "Char", nullable: true}) smtpNotAvailableReason: string; public hostedDomain: HostedDomain; public emailAddresses: EmailAddress[]; public contactDomains: ContactDomain[]; activities: ServerActivity[]; mailboxes: Mailbox[]; hostedZone: HostedZone; subscriptionDomains: SubscriptionDomain[]; }