Browse Source

删除筛选

wuyi 1 year ago
parent
commit
a5438f1009
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/task/task.service.ts

+ 4 - 0
src/task/task.service.ts

@@ -220,6 +220,10 @@ export class TaskService implements OnModuleInit {
     }
 
     async delTask(id: number): Promise<void> {
+        const task = await this.taskRepository.findOneBy({ id })
+        if (task.status !== TaskStatus.IDLE){
+            throw new Error('当前任务状态无法删除!')
+        }
         await this.taskRepository.delete(id)
     }