import Column from "@entity-access/entity-access/dist/decorators/Column.js"; import Table from "@entity-access/entity-access/dist/decorators/Table.js"; import { User } from "./User.js"; import { RelateTo } from "@entity-access/entity-access/dist/decorators/Relate.js"; import Mailbox from "./Mailbox.js"; import Index from "@entity-access/entity-access/dist/decorators/Index.js"; @Table("Signatures") @Index({ name: "IX_Signatures_Unique", unique: true, columns: [ { name: (x) => x.userID, descending: true}, { name: (x) => x.name, descending: false }, { name: (x) => x.mailboxID, descending: false }, ] }) export default class Signature { @Column({ dataType: "BigInt", key: true, generated: "identity"}) signatureID: number; @Column({ dataType: "Char", length: 200 }) name: string; @Column({ dataType: "BigInt"}) @RelateTo(User, { property: (x) => x.user, inverseProperty: (x) => x.signatures }) userID: number; @Column({ dataType: "BigInt", nullable: true}) @RelateTo(Mailbox, { property: (x) => x.mailbox, inverseProperty: (x) => x.signatures }) mailboxID: number; @Column({ dataType: "Char"}) htmlBody: string; user: User; mailbox: Mailbox; }