automated_api/src/modules/flow/controller/admin/info.ts

34 lines
945 B
TypeScript
Raw Normal View History

import { CoolController, BaseController } from '@cool-midway/core';
import { FlowInfoEntity } from '../../entity/info';
import { Body, Inject, Post } from '@midwayjs/core';
import { FlowInfoService } from '../../service/info';
/**
*
*/
@CoolController({
api: ['add', 'delete', 'update', 'info', 'list', 'page'],
entity: FlowInfoEntity,
service: FlowInfoService,
pageQueryOp: {
keyWordLikeFields: ['a.name', 'a.label'],
where: ctx => {
const { flowId, isRelease } = ctx.request.body;
return [
[ 'a.id != :flowId', { flowId }, flowId ],
[ 'a.releaseTime is not null', {}, isRelease ]
]
}
},
})
export class AdminFlowInfoController extends BaseController {
@Inject()
flowInfoService: FlowInfoService;
@Post('/release', { summary: '发布流程' })
async release(@Body('flowId') flowId: number) {
return this.ok(await this.flowInfoService.release(flowId));
}
}