Files
outline/server/models/base/ArchivableModel.ts
T
Tom MoorandGitHub ec3200c7d2 chore: babel -> swc (#12821)
* chore: babel -> swc

* Add ls guard

* PR feedback
2026-06-29 17:11:02 -04:00

26 lines
809 B
TypeScript

import { AllowNull, Column, DataType, IsDate } from "sequelize-typescript";
import ParanoidModel from "./ParanoidModel";
class ArchivableModel<
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mirrors Model base; tightening to object resolves Attributes<M> to never inside Sequelize helpers.
TModelAttributes extends object = any,
TCreationAttributes extends object = TModelAttributes,
> extends ParanoidModel<TModelAttributes, TCreationAttributes> {
/** 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;