perf: cancel task

This commit is contained in:
xiaojunnuo
2023-07-03 11:45:32 +08:00
parent 3eeb1f77aa
commit bc65c0a786
7 changed files with 64 additions and 5 deletions

View File

@@ -11,6 +11,7 @@ import { CrudController } from '../../../basic/crud-controller';
import { PipelineService } from '../service/pipeline-service';
import { PipelineEntity } from '../entity/pipeline';
import { Constants } from '../../../basic/constants';
import { HistoryService } from '../service/history-service';
/**
* 证书
@@ -20,6 +21,8 @@ import { Constants } from '../../../basic/constants';
export class PipelineController extends CrudController<PipelineService> {
@Inject()
service: PipelineService;
@Inject()
historyService: HistoryService;
getService() {
return this.service;
@@ -77,4 +80,11 @@ export class PipelineController extends CrudController<PipelineService> {
await this.service.trigger(id);
return this.ok({});
}
@Post('/cancel', { summary: Constants.per.authOnly })
async cancel(@Query('historyId') historyId) {
await this.historyService.checkUserId(historyId, this.ctx.user.id);
await this.service.cancel(historyId);
return this.ok({});
}
}