import { AllowNull, Column, DataType, IsDate } from "sequelize-typescript"; import ParanoidModel from "./ParanoidModel"; class ArchivableModel< // oxlint-disable-next-line @typescript-eslint/no-explicit-any -- mirrors Model base; tightening to object resolves Attributes to never inside Sequelize helpers. TModelAttributes extends object = any, TCreationAttributes extends object = TModelAttributes, > extends ParanoidModel { /** Whether the document is archived, and if so when. */ @AllowNull @IsDate @Column(DataType.DATE) archivedAt: Date | null; /** * Whether the model has been archived. * * @returns True if the model has been archived */ get isArchived() { return !!this.archivedAt; } } export default ArchivableModel;