chore: 修改权限判断字段从summary改成description

This commit is contained in:
xiaojunnuo
2026-03-15 16:20:20 +08:00
parent b88ee33ae4
commit 25e361b9f9
60 changed files with 385 additions and 385 deletions
@@ -21,7 +21,7 @@ export class AccessController extends CrudController<AccessService> {
return this.service;
}
@Post('/page', { summary: Constants.per.authOnly })
@Post('/page', { description: Constants.per.authOnly })
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', { summary: Constants.per.authOnly })
@Post('/list', { description: Constants.per.authOnly })
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', { summary: Constants.per.authOnly })
@Post('/add', { description: Constants.per.authOnly })
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', { summary: Constants.per.authOnly })
@Post('/update', { description: Constants.per.authOnly })
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', { summary: Constants.per.authOnly })
@Post('/info', { description: Constants.per.authOnly })
async info(@Query('id') id: number) {
await this.checkOwner(this.getService(), id, "read");
return super.info(id);
}
@Post('/delete', { summary: Constants.per.authOnly })
@Post('/delete', { description: Constants.per.authOnly })
async delete(@Query('id') id: number) {
await this.checkOwner(this.getService(), id, "write");
return super.delete(id);
}
@Post('/define', { summary: Constants.per.authOnly })
@Post('/define', { description: Constants.per.authOnly })
async define(@Query('type') type: string) {
const access = this.service.getDefineByType(type);
return this.ok(access);
}
@Post('/getSecretPlain', { summary: Constants.per.authOnly })
@Post('/getSecretPlain', { description: Constants.per.authOnly })
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', { summary: Constants.per.authOnly })
@Post('/accessTypeDict', { description: Constants.per.authOnly })
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', { summary: Constants.per.authOnly })
@Post('/simpleInfo', { description: Constants.per.authOnly })
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', { summary: Constants.per.authOnly })
@Post('/getDictByIds', { description: Constants.per.authOnly })
async getDictByIds(@Body('ids') ids: number[]) {
const { userId, projectId } = await this.getProjectUserIdRead()
const res = await this.service.getSimpleByIds(ids, userId, projectId);
@@ -21,7 +21,7 @@ export class CertController extends BaseController {
userSettingsService: UserSettingsService;
@Post('/get', { summary: Constants.per.authOnly })
@Post('/get', { description: Constants.per.authOnly })
async getCert(@Query('id') id: number) {
const {userId} = await this.getProjectUserIdRead()
@@ -46,7 +46,7 @@ export class CertController extends BaseController {
}
@Post('/readCertDetail', { summary: Constants.per.authOnly })
@Post('/readCertDetail', { description: Constants.per.authOnly })
async readCertDetail(@Body('crt') crt: string) {
if (!crt) {
throw new Error('crt is required');
@@ -14,13 +14,13 @@ export class DnsProviderController extends BaseController {
@Inject()
service: DnsProviderService;
@Post('/list', { summary: Constants.per.authOnly })
@Post('/list', { description: Constants.per.authOnly })
async list(@Query(ALL) query: any) {
const list = this.service.getList();
return this.ok(list);
}
@Post('/dnsProviderTypeDict', { summary: Constants.per.authOnly })
@Post('/dnsProviderTypeDict', { description: Constants.per.authOnly })
async getDnsProviderTypeDict() {
const list = this.service.getList();
const dict = [];
@@ -34,7 +34,7 @@ export class HandleController extends BaseController {
@Inject()
notificationService: NotificationService;
@Post('/access', { summary: Constants.per.authOnly })
@Post('/access', { description: Constants.per.authOnly })
async accessRequest(@Body(ALL) body: AccessRequestHandleReq) {
const {projectId,userId} = await this.getProjectUserIdRead()
let inputAccess = body.input;
@@ -64,7 +64,7 @@ export class HandleController extends BaseController {
return this.ok(res);
}
@Post('/notification', { summary: Constants.per.authOnly })
@Post('/notification', { description: Constants.per.authOnly })
async notificationRequest(@Body(ALL) body: NotificationRequestHandleReq) {
const input = body.input;
@@ -80,7 +80,7 @@ export class HandleController extends BaseController {
return this.ok(res);
}
@Post('/plugin', { summary: Constants.per.authOnly })
@Post('/plugin', { description: Constants.per.authOnly })
async pluginRequest(@Body(ALL) body: PluginRequestHandleReq) {
const {projectId,userId} = await this.getProjectUserIdRead()
const pluginDefine = pluginRegistry.get(body.typeName);
@@ -41,7 +41,7 @@ export class HistoryController extends CrudController<HistoryService> {
return this.service;
}
@Post('/page', { summary: Constants.per.authOnly })
@Post('/page', { description: Constants.per.authOnly })
async page(@Body(ALL) body: any) {
const { projectId, userId } = await this.getProjectUserIdRead()
body.query.projectId = projectId
@@ -88,7 +88,7 @@ export class HistoryController extends CrudController<HistoryService> {
return this.ok(res);
}
@Post('/list', { summary: Constants.per.authOnly })
@Post('/list', { description: Constants.per.authOnly })
async list(@Body(ALL) body) {
const { projectId, userId } = await this.getProjectUserIdRead()
if (!body){
@@ -151,7 +151,7 @@ export class HistoryController extends CrudController<HistoryService> {
return this.ok(listRet);
}
@Post('/add', { summary: Constants.per.authOnly })
@Post('/add', { description: Constants.per.authOnly })
async add(@Body(ALL) bean: PipelineEntity) {
const { projectId, userId } = await this.getProjectUserIdRead()
bean.projectId = projectId
@@ -159,7 +159,7 @@ export class HistoryController extends CrudController<HistoryService> {
return super.add(bean);
}
@Post('/update', { summary: Constants.per.authOnly })
@Post('/update', { description: Constants.per.authOnly })
async update(@Body(ALL) bean) {
await this.checkOwner(this.getService(), bean.id,"write",true);
delete bean.userId;
@@ -167,7 +167,7 @@ export class HistoryController extends CrudController<HistoryService> {
return super.update(bean);
}
@Post('/save', { summary: Constants.per.authOnly })
@Post('/save', { description: Constants.per.authOnly })
async save(@Body(ALL) bean: HistoryEntity) {
const { projectId,userId } = await this.getProjectUserIdWrite()
bean.userId = userId;
@@ -183,7 +183,7 @@ export class HistoryController extends CrudController<HistoryService> {
return this.ok(bean.id);
}
@Post('/saveLog', { summary: Constants.per.authOnly })
@Post('/saveLog', { description: Constants.per.authOnly })
async saveLog(@Body(ALL) bean: HistoryLogEntity) {
const { projectId,userId } = await this.getProjectUserIdWrite()
bean.projectId = projectId;
@@ -198,14 +198,14 @@ export class HistoryController extends CrudController<HistoryService> {
return this.ok(bean.id);
}
@Post('/delete', { summary: Constants.per.authOnly })
@Post('/delete', { description: Constants.per.authOnly })
async delete(@Query('id') id: number) {
await this.checkOwner(this.getService(), id,"write",true);
await super.delete(id);
return this.ok();
}
@Post('/deleteByIds', { summary: Constants.per.authOnly })
@Post('/deleteByIds', { description: Constants.per.authOnly })
async deleteByIds(@Body(ALL) body: any) {
let {userId} = await this.checkOwner(this.getService(), body.ids,"write",true);
const isAdmin = await this.authService.isAdmin(this.ctx);
@@ -214,21 +214,21 @@ export class HistoryController extends CrudController<HistoryService> {
return this.ok();
}
@Post('/detail', { summary: Constants.per.authOnly })
@Post('/detail', { description: Constants.per.authOnly })
async detail(@Query('id') id: number) {
await this.checkOwner(this.getService(), id,"read",true);
const detail = await this.service.detail(id);
return this.ok(detail);
}
@Post('/logs', { summary: Constants.per.authOnly })
@Post('/logs', { description: Constants.per.authOnly })
async logs(@Query('id') id: number) {
await this.checkOwner(this.logService, id,"read",true);
const logInfo = await this.logService.info(id);
return this.ok(logInfo);
}
@Post('/files', { summary: Constants.per.authOnly })
@Post('/files', { description: Constants.per.authOnly })
async files(@Query('pipelineId') pipelineId: number, @Query('historyId') historyId: number) {
const files = await this.getFiles(historyId, pipelineId);
return this.ok(files);
@@ -269,7 +269,7 @@ export class HistoryController extends CrudController<HistoryService> {
return await this.service.getFiles(history);
}
@Get('/download', { summary: Constants.per.authOnly })
@Get('/download', { description: Constants.per.authOnly })
async download(@Query('pipelineId') pipelineId: number, @Query('historyId') historyId: number, @Query('fileId') fileId: string) {
const files = await this.getFiles(historyId, pipelineId);
const file = files.find(f => f.id === fileId);
@@ -22,7 +22,7 @@ export class NotificationController extends CrudController<NotificationService>
return this.service;
}
@Post('/page', { summary: Constants.per.authOnly })
@Post('/page', { description: Constants.per.authOnly })
async page(@Body(ALL) body) {
const {projectId,userId} = await this.getProjectUserIdRead();
body.query = body.query ?? {};
@@ -40,7 +40,7 @@ export class NotificationController extends CrudController<NotificationService>
return this.ok(res);
}
@Post('/list', { summary: Constants.per.authOnly })
@Post('/list', { description: Constants.per.authOnly })
async list(@Body(ALL) body) {
const {projectId,userId} = await this.getProjectUserIdRead();
body.query = body.query ?? {};
@@ -49,7 +49,7 @@ export class NotificationController extends CrudController<NotificationService>
return super.list(body);
}
@Post('/add', { summary: Constants.per.authOnly })
@Post('/add', { description: Constants.per.authOnly })
async add(@Body(ALL) bean) {
const {projectId,userId} = await this.getProjectUserIdRead();
bean.userId = userId;
@@ -65,7 +65,7 @@ export class NotificationController extends CrudController<NotificationService>
return super.add(bean);
}
@Post('/update', { summary: Constants.per.authOnly })
@Post('/update', { description: Constants.per.authOnly })
async update(@Body(ALL) bean) {
await this.checkOwner(this.getService(), bean.id,"write");
const old = await this.service.info(bean.id);
@@ -86,25 +86,25 @@ export class NotificationController extends CrudController<NotificationService>
delete bean.projectId;
return super.update(bean);
}
@Post('/info', { summary: Constants.per.authOnly })
@Post('/info', { description: Constants.per.authOnly })
async info(@Query('id') id: number) {
await this.checkOwner(this.getService(), id,"read");
return super.info(id);
}
@Post('/delete', { summary: Constants.per.authOnly })
@Post('/delete', { description: Constants.per.authOnly })
async delete(@Query('id') id: number) {
await this.checkOwner(this.getService(), id,"write");
return super.delete(id);
}
@Post('/define', { summary: Constants.per.authOnly })
@Post('/define', { description: Constants.per.authOnly })
async define(@Query('type') type: string) {
const notification = this.service.getDefineByType(type);
return this.ok(notification);
}
@Post('/getTypeDict', { summary: Constants.per.authOnly })
@Post('/getTypeDict', { description: Constants.per.authOnly })
async getTypeDict() {
const list: any = this.service.getDefineList();
let dict = [];
@@ -125,7 +125,7 @@ export class NotificationController extends CrudController<NotificationService>
return this.ok(dict);
}
@Post('/simpleInfo', { summary: Constants.per.authOnly })
@Post('/simpleInfo', { description: Constants.per.authOnly })
async simpleInfo(@Query('id') id: number) {
const {projectId,userId} = await this.getProjectUserIdRead();
if (id === 0) {
@@ -142,14 +142,14 @@ export class NotificationController extends CrudController<NotificationService>
return this.ok(res);
}
@Post('/getDefaultId', { summary: Constants.per.authOnly })
@Post('/getDefaultId', { description: Constants.per.authOnly })
async getDefaultId() {
const {projectId,userId} = await this.getProjectUserIdRead();
const res = await this.service.getDefault(userId,projectId);
return this.ok(res?.id);
}
@Post('/setDefault', { summary: Constants.per.authOnly })
@Post('/setDefault', { description: Constants.per.authOnly })
async setDefault(@Query('id') id: number) {
const {projectId,userId} = await this.getProjectUserIdRead();
await this.checkOwner(this.getService(), id,"write");
@@ -157,14 +157,14 @@ export class NotificationController extends CrudController<NotificationService>
return this.ok(res);
}
@Post('/getOrCreateDefault', { summary: Constants.per.authOnly })
@Post('/getOrCreateDefault', { description: Constants.per.authOnly })
async getOrCreateDefault(@Body('email') email: string) {
const {projectId,userId} = await this.getProjectUserIdRead();
const res = await this.service.getOrCreateDefault(email, userId,projectId);
return this.ok(res);
}
@Post('/options', { summary: Constants.per.authOnly })
@Post('/options', { description: Constants.per.authOnly })
async options() {
const {projectId,userId} = await this.getProjectUserIdRead();
const res = await this.service.list({
@@ -32,7 +32,7 @@ export class PipelineController extends CrudController<PipelineService> {
return this.service;
}
@Post('/page', { summary: Constants.per.authOnly })
@Post('/page', { description: Constants.per.authOnly })
async page(@Body(ALL) body) {
const isAdmin = await this.authService.isAdmin(this.ctx);
const publicSettings = await this.sysSettingsService.getPublicSettings();
@@ -79,7 +79,7 @@ export class PipelineController extends CrudController<PipelineService> {
return this.ok(pageRet);
}
@Post('/getSimpleByIds', { summary: Constants.per.authOnly })
@Post('/getSimpleByIds', { description: Constants.per.authOnly })
async getSimpleById(@Body(ALL) body) {
const { projectId, userId } = await this.getProjectUserIdRead()
const ret = await this.getService().getSimplePipelines(body.ids, userId, projectId);
@@ -87,7 +87,7 @@ export class PipelineController extends CrudController<PipelineService> {
}
// @Post('/add', { summary: Constants.per.authOnly })
// @Post('/add', { description: Constants.per.authOnly })
// async add(@Body(ALL) bean: PipelineEntity) {
// const { projectId, userId } = await this.getProjectUserIdWrite()
// bean.userId = userId
@@ -95,7 +95,7 @@ export class PipelineController extends CrudController<PipelineService> {
// return super.add(bean);
// }
// @Post('/update', { summary: Constants.per.authOnly })
// @Post('/update', { description: Constants.per.authOnly })
// async update(@Body(ALL) bean) {
// await this.checkOwner(this.getService(), bean.id,"write",true);
// delete bean.userId;
@@ -103,7 +103,7 @@ export class PipelineController extends CrudController<PipelineService> {
// return super.update(bean);
// }
@Post('/save', { summary: Constants.per.authOnly,description: '新增/更新流水线' })
@Post('/save', { description: Constants.per.authOnly, summary: '新增/更新流水线' })
async save(@Body(ALL) bean: { addToMonitorEnabled: boolean, addToMonitorDomains: string } & PipelineEntity) {
const { userId ,projectId} = await this.getProjectUserIdWrite()
if (bean.id > 0) {
@@ -136,14 +136,14 @@ export class PipelineController extends CrudController<PipelineService> {
return this.ok({ id: bean.id, version: version });
}
@Post('/delete', { summary: Constants.per.authOnly })
@Post('/delete', { description: Constants.per.authOnly })
async delete(@Query('id') id: number) {
await this.checkOwner(this.getService(), id,"write",true);
await this.service.delete(id);
return this.ok({});
}
@Post('/disabled', { summary: Constants.per.authOnly })
@Post('/disabled', { description: Constants.per.authOnly })
async disabled(@Body(ALL) bean) {
await this.checkOwner(this.getService(), bean.id,"write",true);
delete bean.userId;
@@ -152,28 +152,28 @@ export class PipelineController extends CrudController<PipelineService> {
return this.ok({});
}
@Post('/detail', { summary: Constants.per.authOnly })
@Post('/detail', { description: Constants.per.authOnly })
async detail(@Query('id') id: number) {
await this.checkOwner(this.getService(), id,"read",true);
const detail = await this.service.detail(id);
return this.ok(detail);
}
@Post('/trigger', { summary: Constants.per.authOnly })
@Post('/trigger', { description: Constants.per.authOnly })
async trigger(@Query('id') id: number, @Query('stepId') stepId?: string) {
await this.checkOwner(this.getService(), id,"write",true);
await this.service.trigger(id, stepId, true);
return this.ok({});
}
@Post('/cancel', { summary: Constants.per.authOnly })
@Post('/cancel', { description: Constants.per.authOnly })
async cancel(@Query('historyId') historyId: number) {
await this.checkOwner(this.historyService, historyId,"write",true);
await this.service.cancel(historyId);
return this.ok({});
}
@Post('/count', { summary: Constants.per.authOnly })
@Post('/count', { description: Constants.per.authOnly })
async count() {
const { userId } = await this.getProjectUserIdRead()
const count = await this.service.count({ userId: userId });
@@ -191,7 +191,7 @@ export class PipelineController extends CrudController<PipelineService> {
return await callback({userId});
}
@Post('/batchDelete', { summary: Constants.per.authOnly })
@Post('/batchDelete', { description: Constants.per.authOnly })
async batchDelete(@Body('ids') ids: number[]) {
// let { projectId ,userId} = await this.getProjectUserIdWrite()
// if(projectId){
@@ -210,7 +210,7 @@ export class PipelineController extends CrudController<PipelineService> {
@Post('/batchUpdateGroup', { summary: Constants.per.authOnly })
@Post('/batchUpdateGroup', { description: Constants.per.authOnly })
async batchUpdateGroup(@Body('ids') ids: number[], @Body('groupId') groupId: number) {
// let { projectId ,userId} = await this.getProjectUserIdWrite()
// if(projectId){
@@ -228,7 +228,7 @@ export class PipelineController extends CrudController<PipelineService> {
}
@Post('/batchUpdateTrigger', { summary: Constants.per.authOnly })
@Post('/batchUpdateTrigger', { description: Constants.per.authOnly })
async batchUpdateTrigger(@Body('ids') ids: number[], @Body('trigger') trigger: any) {
// let { projectId ,userId} = await this.getProjectUserIdWrite()
// if(projectId){
@@ -245,7 +245,7 @@ export class PipelineController extends CrudController<PipelineService> {
return this.ok({});
}
@Post('/batchUpdateNotification', { summary: Constants.per.authOnly })
@Post('/batchUpdateNotification', { description: Constants.per.authOnly })
async batchUpdateNotification(@Body('ids') ids: number[], @Body('notification') notification: any) {
// const isAdmin = await this.authService.isAdmin(this.ctx);
// const userId = isAdmin ? undefined : this.getUserId();
@@ -256,7 +256,7 @@ export class PipelineController extends CrudController<PipelineService> {
return this.ok({});
}
@Post('/batchRerun', { summary: Constants.per.authOnly })
@Post('/batchRerun', { description: Constants.per.authOnly })
async batchRerun(@Body('ids') ids: number[], @Body('force') force: boolean) {
await this.checkPermissionCall(async ({userId,projectId})=>{
await this.service.batchRerun(ids, force,userId,projectId);
@@ -264,7 +264,7 @@ export class PipelineController extends CrudController<PipelineService> {
return this.ok({});
}
@Post('/batchTransfer', { summary: Constants.per.authOnly })
@Post('/batchTransfer', { description: Constants.per.authOnly })
async batchTransfer(@Body('ids') ids: number[], @Body('toProjectId') toProjectId: number) {
await this.checkPermissionCall(async ({})=>{
await this.service.batchTransfer(ids, toProjectId);
@@ -272,7 +272,7 @@ export class PipelineController extends CrudController<PipelineService> {
return this.ok({});
}
@Post('/refreshWebhookKey', { summary: Constants.per.authOnly })
@Post('/refreshWebhookKey', { description: Constants.per.authOnly })
async refreshWebhookKey(@Body('id') id: number) {
await this.checkOwner(this.getService(), id,"write",true);
const res = await this.service.refreshWebhookKey(id);
@@ -20,7 +20,7 @@ export class PipelineGroupController extends CrudController<PipelineGroupService
return this.service;
}
@Post('/page', { summary: Constants.per.authOnly })
@Post('/page', { description: Constants.per.authOnly })
async page(@Body(ALL) body: any) {
const {projectId,userId} = await this.getProjectUserIdRead();
body.query = body.query ?? {};
@@ -38,7 +38,7 @@ export class PipelineGroupController extends CrudController<PipelineGroupService
return this.ok(res);
}
@Post('/list', { summary: Constants.per.authOnly })
@Post('/list', { description: Constants.per.authOnly })
async list(@Body(ALL) body: any) {
const {projectId,userId} = await this.getProjectUserIdRead();
body.query = body.query ?? {};
@@ -47,7 +47,7 @@ export class PipelineGroupController extends CrudController<PipelineGroupService
return await super.list(body);
}
@Post('/add', { summary: Constants.per.authOnly })
@Post('/add', { description: Constants.per.authOnly })
async add(@Body(ALL) bean: any) {
const {projectId,userId} = await this.getProjectUserIdRead();
bean.userId = userId;
@@ -55,26 +55,26 @@ export class PipelineGroupController extends CrudController<PipelineGroupService
return await super.add(bean);
}
@Post('/update', { summary: Constants.per.authOnly })
@Post('/update', { description: Constants.per.authOnly })
async update(@Body(ALL) bean) {
await this.checkOwner(this.getService(), bean.id, "write");
delete bean.userId;
delete bean.projectId;
return await super.update(bean);
}
@Post('/info', { summary: Constants.per.authOnly })
@Post('/info', { description: Constants.per.authOnly })
async info(@Query('id') id: number) {
await this.checkOwner(this.getService(), id, "read");
return await super.info(id);
}
@Post('/delete', { summary: Constants.per.authOnly })
@Post('/delete', { description: Constants.per.authOnly })
async delete(@Query('id') id: number) {
await this.checkOwner(this.getService(), id, "write");
return await super.delete(id);
}
@Post('/all', { summary: Constants.per.authOnly })
@Post('/all', { description: Constants.per.authOnly })
async all() {
const {projectId,userId} = await this.getProjectUserIdRead();
const list: any = await this.service.find({
@@ -18,19 +18,19 @@ export class PluginController extends BaseController {
@Inject()
pluginConfigService: PluginConfigService;
@Post('/list', { summary: Constants.per.authOnly })
@Post('/list', { description: Constants.per.authOnly })
async list(@Query(ALL) query: any) {
const list = await this.service.getEnabledBuiltInList();
return this.ok(list);
}
@Post('/groups', { summary: Constants.per.authOnly })
@Post('/groups', { description: Constants.per.authOnly })
async groups(@Query(ALL) query: any) {
const group = await this.service.getEnabledBuildInGroup();
return this.ok(group);
}
@Post('/groupsList', { summary: Constants.per.authOnly })
@Post('/groupsList', { description: Constants.per.authOnly })
async groupsList(@Query(ALL) query: any) {
const groups = pluginGroups
const groupsList:any = []
@@ -44,13 +44,13 @@ export class PluginController extends BaseController {
return this.ok(groupsList);
}
@Post('/getDefineByType', { summary: Constants.per.authOnly })
@Post('/getDefineByType', { description: Constants.per.authOnly })
async getDefineByType(@Body('type') type: string) {
const define = await this.service.getDefineByType(type);
return this.ok(define);
}
@Post('/config', { summary: Constants.per.authOnly })
@Post('/config', { description: Constants.per.authOnly })
async config(@Body(ALL) body: { id?: number; name?: string; type: string }) {
const config = await this.pluginConfigService.getPluginConfig(body);
return this.ok(config);
@@ -22,7 +22,7 @@ export class SubDomainController extends CrudController<SubDomainService> {
return this.service;
}
@Post('/parseDomain', { summary: Constants.per.authOnly })
@Post('/parseDomain', { description: Constants.per.authOnly })
async parseDomain(@Body("fullDomain") fullDomain:string) {
const {projectId,userId} = await this.getProjectUserIdRead();
const taskService = this.taskServiceBuilder.create({ userId: userId, projectId: projectId });
@@ -33,7 +33,7 @@ export class SubDomainController extends CrudController<SubDomainService> {
}
@Post('/page', { summary: Constants.per.authOnly })
@Post('/page', { description: Constants.per.authOnly })
async page(@Body(ALL) body) {
const {userId,projectId} = await this.getProjectUserIdRead();
body.query = body.query ?? {};
@@ -51,7 +51,7 @@ export class SubDomainController extends CrudController<SubDomainService> {
return this.ok(res);
}
@Post('/list', { summary: Constants.per.authOnly })
@Post('/list', { description: Constants.per.authOnly })
async list(@Body(ALL) body) {
const {userId,projectId} = await this.getProjectUserIdRead();
body.query = body.query ?? {};
@@ -60,7 +60,7 @@ export class SubDomainController extends CrudController<SubDomainService> {
return super.list(body);
}
@Post('/add', { summary: Constants.per.authOnly })
@Post('/add', { description: Constants.per.authOnly })
async add(@Body(ALL) bean) {
const {userId,projectId} = await this.getProjectUserIdRead();
bean.userId = userId;
@@ -68,26 +68,26 @@ export class SubDomainController extends CrudController<SubDomainService> {
return super.add(bean);
}
@Post('/update', { summary: Constants.per.authOnly })
@Post('/update', { description: Constants.per.authOnly })
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', { summary: Constants.per.authOnly })
@Post('/info', { description: Constants.per.authOnly })
async info(@Query('id') id: number) {
await this.checkOwner(this.getService(), id, "read");
return super.info(id);
}
@Post('/delete', { summary: Constants.per.authOnly })
@Post('/delete', { description: Constants.per.authOnly })
async delete(@Query('id') id: number) {
await this.checkOwner(this.getService(), id, "write");
return super.delete(id);
}
@Post('/batchDelete', { summary: Constants.per.authOnly })
@Post('/batchDelete', { description: Constants.per.authOnly })
async batchDelete(@Body('ids') ids: number[]) {
const {userId,projectId} = await this.getProjectUserIdWrite();
await this.service.batchDelete(ids, userId, projectId);
@@ -19,7 +19,7 @@ export class TemplateController extends CrudController<TemplateService> {
}
@Post('/page', { summary: Constants.per.authOnly })
@Post('/page', { description: Constants.per.authOnly })
async page(@Body(ALL) body) {
body.query = body.query ?? {};
@@ -39,7 +39,7 @@ export class TemplateController extends CrudController<TemplateService> {
return this.ok(res);
}
@Post('/list', { summary: Constants.per.authOnly })
@Post('/list', { description: Constants.per.authOnly })
async list(@Body(ALL) body) {
body.query = body.query ?? {};
const { projectId, userId } = await this.getProjectUserIdRead()
@@ -48,7 +48,7 @@ export class TemplateController extends CrudController<TemplateService> {
return super.list(body);
}
@Post('/add', { summary: Constants.per.authOnly })
@Post('/add', { description: Constants.per.authOnly })
async add(@Body(ALL) bean) {
const { projectId, userId } = await this.getProjectUserIdRead()
bean.userId = userId;
@@ -57,40 +57,40 @@ export class TemplateController extends CrudController<TemplateService> {
return super.add(bean);
}
@Post('/update', { summary: Constants.per.authOnly })
@Post('/update', { description: Constants.per.authOnly })
async update(@Body(ALL) bean) {
await this.checkOwner(this.service, bean.id, "write");
delete bean.userId;
delete bean.projectId;
return super.update(bean);
}
@Post('/info', { summary: Constants.per.authOnly })
@Post('/info', { description: Constants.per.authOnly })
async info(@Query('id') id: number) {
await this.checkOwner(this.service, id, "read");
return super.info(id);
}
@Post('/delete', { summary: Constants.per.authOnly })
@Post('/delete', { description: Constants.per.authOnly })
async delete(@Query('id') id: number) {
const { userId ,projectId } = await this.getProjectUserIdWrite()
await this.service.batchDelete([id], userId,projectId);
return this.ok({});
}
@Post('/batchDelete', { summary: Constants.per.authOnly })
@Post('/batchDelete', { description: Constants.per.authOnly })
async batchDelete(@Body('ids') ids: number[]) {
const { userId ,projectId } = await this.getProjectUserIdWrite()
await this.service.batchDelete(ids, userId,projectId);
return this.ok({});
}
@Post('/detail', { summary: Constants.per.authOnly })
@Post('/detail', { description: Constants.per.authOnly })
async detail(@Query('id') id: number) {
const { userId ,projectId } = await this.getProjectUserIdRead()
const detail = await this.service.detail(id, userId,projectId);
return this.ok(detail);
}
@Post('/createPipelineByTemplate', { summary: Constants.per.authOnly })
@Post('/createPipelineByTemplate', { description: Constants.per.authOnly })
async createPipelineByTemplate(@Body(ALL) body: any) {
const { userId ,projectId } = await this.getProjectUserIdWrite()
body.userId = userId;