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 { HostedDomain } from "./HostedDomain.js"; const relayKind = ["smtp", "ses", "https"] as const; type relayKindType = typeof relayKind[number]; @Table("DomainRelays") export default class DomainRelay { @Column({ generated: "identity", key: true, dataType: "BigInt"}) public domainRelayID: number; @Column({ dataType: "BigInt"}) @RelateTo(HostedDomain, { property: (dr) => dr.hostedDomain, inverseProperty: (hd) => hd.relays }) public domainID: number; @Column({ dataType: "AsciiChar", length: 20, enum: relayKind}) public type: relayKindType; @Column({ dataType: "Char", length: 400}) public host: string; @Column({ dataType: "Char", length: 100 }) public username: string; @Column({ dataType: "Char", length: 100 }) public password: string; @Column({ dataType: "Int", default: () => 0 }) public priority: number; @Column({ dataType: "Char", nullable: true}) public script: string; public hostedDomain: HostedDomain; }