mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
refactor(server): use doc model on doc cron job (#10057)
This commit is contained in:
@@ -265,6 +265,21 @@ export class DocModel extends BaseModel {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete expired histories.
|
||||
*/
|
||||
async deleteExpiredHistories() {
|
||||
const { count } = await this.db.snapshotHistory.deleteMany({
|
||||
where: {
|
||||
expiredAt: {
|
||||
lte: new Date(),
|
||||
},
|
||||
},
|
||||
});
|
||||
this.logger.log(`Deleted ${count} expired histories`);
|
||||
return count;
|
||||
}
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region Doc
|
||||
|
||||
Reference in New Issue
Block a user