mirror of
https://github.com/certd/certd.git
synced 2026-07-13 17:07:32 +08:00
021155278e
1. 新增后台管理页面:用户流水线管理、用户证书监控管理 2. 新增对应前后端接口与控制器 3. 添加多语言国际化配置 4. 修复导入顺序与多余空行问题 5. 补充证书申请类型选项
54 lines
1.7 KiB
TypeScript
54 lines
1.7 KiB
TypeScript
import { ALL, Body, Controller, Inject, Post, Provide, Query } from "@midwayjs/core";
|
|
import { CrudController } from "@certd/lib-server";
|
|
import { ApiTags } from "@midwayjs/swagger";
|
|
import { PipelineService } from "../../../modules/pipeline/service/pipeline-service.js";
|
|
import { checkPlus } from "@certd/plus-core";
|
|
|
|
@Provide()
|
|
@Controller("/api/sys/pipeline")
|
|
@ApiTags(["sys-pipeline"])
|
|
export class SysPipelineController extends CrudController<PipelineService> {
|
|
@Inject()
|
|
service: PipelineService;
|
|
|
|
getService(): PipelineService {
|
|
return this.service;
|
|
}
|
|
|
|
@Post("/page", { description: "sys:settings:view", summary: "管理员查询用户流水线分页列表" })
|
|
async page(@Body(ALL) body: any) {
|
|
body.query = body.query ?? {};
|
|
const title = body.query.title;
|
|
delete body.query.title;
|
|
|
|
if (!body.sort || !body.sort?.prop) {
|
|
body.sort = { prop: "order", asc: false };
|
|
}
|
|
|
|
const res = await this.service.page({
|
|
query: body.query,
|
|
page: body.page,
|
|
sort: body.sort,
|
|
buildQuery: bq => {
|
|
if (title) {
|
|
bq.andWhere("(title like :title or content like :content)", { title: `%${title}%`, content: `%${title}%` });
|
|
}
|
|
},
|
|
});
|
|
return this.ok(res);
|
|
}
|
|
|
|
@Post("/delete", { description: "sys:settings:edit", summary: "管理员删除用户流水线" })
|
|
async delete(@Query("id") id: number) {
|
|
await this.service.delete(id);
|
|
return this.ok();
|
|
}
|
|
|
|
@Post("/batchDelete", { description: "sys:settings:edit", summary: "管理员批量删除用户流水线" })
|
|
async batchDelete(@Body("ids") ids: number[]) {
|
|
checkPlus();
|
|
await this.service.batchDelete(ids);
|
|
return this.ok();
|
|
}
|
|
}
|