chore: 增加流水线,授权等文档

This commit is contained in:
xiaojunnuo
2026-03-15 18:26:49 +08:00
parent 25e361b9f9
commit 1cbf9c1cd9
42 changed files with 497 additions and 241 deletions
@@ -21,7 +21,7 @@ export class AccessController extends CrudController<AccessService> {
return this.service;
}
@Post('/page', { description: Constants.per.authOnly })
@Post('/page', { description: Constants.per.authOnly, summary: "查询授权配置分页列表" })
async page(@Body(ALL) body) {
const { projectId, userId } = await this.getProjectUserIdRead()
body.query = body.query ?? {};
@@ -44,7 +44,7 @@ export class AccessController extends CrudController<AccessService> {
return this.ok(res);
}
@Post('/list', { description: Constants.per.authOnly })
@Post('/list', { description: Constants.per.authOnly, summary: "查询授权配置列表" })
async list(@Body(ALL) body) {
const { projectId, userId } = await this.getProjectUserIdRead()
body.query = body.query ?? {};
@@ -53,7 +53,7 @@ export class AccessController extends CrudController<AccessService> {
return super.list(body);
}
@Post('/add', { description: Constants.per.authOnly })
@Post('/add', { description: Constants.per.authOnly, summary: "添加授权配置" })
async add(@Body(ALL) bean) {
const { projectId, userId } = await this.getProjectUserIdWrite()
bean.userId = userId;
@@ -61,39 +61,39 @@ export class AccessController extends CrudController<AccessService> {
return super.add(bean);
}
@Post('/update', { description: Constants.per.authOnly })
@Post('/update', { description: Constants.per.authOnly, summary: "更新授权配置" })
async update(@Body(ALL) bean) {
await this.checkOwner(this.getService(), bean.id, "write");
delete bean.userId;
delete bean.projectId;
return super.update(bean);
}
@Post('/info', { description: Constants.per.authOnly })
@Post('/info', { description: Constants.per.authOnly, summary: "查询授权配置详情" })
async info(@Query('id') id: number) {
await this.checkOwner(this.getService(), id, "read");
return super.info(id);
}
@Post('/delete', { description: Constants.per.authOnly })
@Post('/delete', { description: Constants.per.authOnly, summary: "删除授权配置" })
async delete(@Query('id') id: number) {
await this.checkOwner(this.getService(), id, "write");
return super.delete(id);
}
@Post('/define', { description: Constants.per.authOnly })
@Post('/define', { description: Constants.per.authOnly, summary: "查询授权插件定义" })
async define(@Query('type') type: string) {
const access = this.service.getDefineByType(type);
return this.ok(access);
}
@Post('/getSecretPlain', { description: Constants.per.authOnly })
@Post('/getSecretPlain', { description: Constants.per.authOnly, summary: "获取授权配置明文密钥" })
async getSecretPlain(@Body(ALL) body: { id: number; key: string }) {
const {userId, projectId} = await this.checkOwner(this.getService(), body.id, "read");
const value = await this.service.getById(body.id, userId, projectId);
return this.ok(value[body.key]);
}
@Post('/accessTypeDict', { description: Constants.per.authOnly })
@Post('/accessTypeDict', { description: Constants.per.authOnly, summary: "查询授权类型字典" })
async getAccessTypeDict() {
let list: AccessDefine[] = this.service.getDefineList();
list = list.sort((a,b) => {
@@ -110,7 +110,7 @@ export class AccessController extends CrudController<AccessService> {
return this.ok(dict);
}
@Post('/simpleInfo', { description: Constants.per.authOnly })
@Post('/simpleInfo', { description: Constants.per.authOnly, summary: "查询授权配置简单信息" })
async simpleInfo(@Query('id') id: number) {
// await this.authService.checkUserIdButAllowAdmin(this.ctx, this.service, id);
// await this.checkOwner(this.getService(), id, "read",true);
@@ -118,7 +118,7 @@ export class AccessController extends CrudController<AccessService> {
return this.ok(res);
}
@Post('/getDictByIds', { description: Constants.per.authOnly })
@Post('/getDictByIds', { description: Constants.per.authOnly, summary: "根据ID列表获取授权配置字典" })
async getDictByIds(@Body('ids') ids: number[]) {
const { userId, projectId } = await this.getProjectUserIdRead()
const res = await this.service.getSimpleByIds(ids, userId, projectId);