Files
outline/server/models/base/ArchivableModel.ts
T
Apoorv Mishra be5f092117 Show nested docs on Archive page (#7488)
* fix: nested docs should appear in archive

* fix(app): ArchivableModel

* fix(server): ArchivableModel

* fix: PartialWithArchivedAt not needed

* fix: new PartialExcept type

* fix: restore deletion

* fix: review
2024-10-02 10:10:41 +05:30

26 lines
658 B
TypeScript

/* eslint-disable @typescript-eslint/ban-types */
import { AllowNull, Column, IsDate } from "sequelize-typescript";
import ParanoidModel from "./ParanoidModel";
class ArchivableModel<
TModelAttributes extends {} = any,
TCreationAttributes extends {} = TModelAttributes
> extends ParanoidModel<TModelAttributes, TCreationAttributes> {
/** Whether the document is archived, and if so when. */
@AllowNull
@IsDate
@Column
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;