perf: 流水线支持名称模糊查询

This commit is contained in:
xiaojunnuo
2024-08-04 02:35:45 +08:00
parent a9717b9a0d
commit 59897c4cea
14 changed files with 157 additions and 28 deletions

View File

@@ -23,9 +23,19 @@ export class PipelineController extends CrudController<PipelineService> {
@Post('/page', { summary: Constants.per.authOnly })
async page(@Body(ALL) body) {
body.query.userId = this.ctx.user.id;
const title = body.query.title;
delete body.query.title;
const buildQuery = qb => {
qb.where({});
if (title) {
qb.where('title like :title', { title: `%${title}%` });
}
};
if (!body.sort || !body.sort?.prop) {
body.sort = { prop: 'order', asc: false };
}
return super.page({ ...body, buildQuery });
}
@@ -48,7 +58,6 @@ export class PipelineController extends CrudController<PipelineService> {
await this.service.checkUserId(bean.id, this.ctx.user.id);
}
await this.service.save(bean);
await this.service.registerTriggerById(bean.id);
return this.ok(bean.id);
}