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 { Email } from "./Email.js"; /** * This class saves engagement statistics (counts). */ @Table("EmailEngagements") export default class EmailEngagement { @Column({ dataType: "BigInt", key: true, order: 1}) @RelateTo(Email, { property: (x) => x.email, inverseProperty: (x) => x.engagements, foreignKeyConstraint: { name: "FC_Email_Engagements", onDelete: "cascade" } }) public emailID: number; @Column({ dataType: "Char", length: 200, key: true, order: 2}) public engagement: string; @Column({ dataType: "Int"}) public count: number; public email: Email; }