yohei0125 4 лет назад
Родитель
Сommit
119bd168eb
1 измененных файлов с 2 добавлено и 6 удалено
  1. 2 6
      packages/app/src/server/models/page-operation.ts

+ 2 - 6
packages/app/src/server/models/page-operation.ts

@@ -125,12 +125,8 @@ schema.statics.findMainOps = async function(
   );
   );
 };
 };
 
 
-schema.statics.cleanup = async function(excludeList: PageActionType[]): Promise<void> {
-  await this.deleteMany({ actionType: { $nin: excludeList } });
-};
-
-schema.statics.markAsFailure = async function(): Promise<void> {
-  await this.updateMany({}, { isFailure: true });
+schema.statics.cleanup = async function(excludeActionTypeList: PageActionType[], excludeStage: PageActionStage): Promise<void> {
+  await this.deleteMany({ actionType: { $nin: excludeActionTypeList }, actionStage: { $ne: excludeStage } });
 };
 };
 
 
 export default getOrCreateModel<PageOperationDocument, PageOperationModel>('PageOperation', schema);
 export default getOrCreateModel<PageOperationDocument, PageOperationModel>('PageOperation', schema);