diff --git a/packages/ui/certd-server/src/controller/basic/app-controller.ts b/packages/ui/certd-server/src/controller/basic/app-controller.ts index 4049350e3..b77ac5c50 100644 --- a/packages/ui/certd-server/src/controller/basic/app-controller.ts +++ b/packages/ui/certd-server/src/controller/basic/app-controller.ts @@ -13,7 +13,7 @@ export class AppController extends BaseController { @Inject() fileService: FileService; - @Get('/latest', { summary: Constants.per.authOnly }) + @Get('/latest', { description: Constants.per.authOnly }) async latest(): Promise { try { const res = await http.request({ @@ -30,7 +30,7 @@ export class AppController extends BaseController { } } - @Get('/favicon', { summary: Constants.per.guest }) + @Get('/favicon', { description: Constants.per.guest }) public async getFavicon() { if (isComm()) { const siteInfo = await this.sysSettingsService.getSetting(SysSiteInfo); @@ -47,7 +47,7 @@ export class AppController extends BaseController { this.ctx.response.set('Cache-Control', 'public,max-age=25920'); } - @Post('/webhook', { summary: Constants.per.guest }) + @Post('/webhook', { description: Constants.per.guest }) public async webhook( @Body() body: any) { logger.info('webhook', JSON.stringify(body)) return this.ok("success") diff --git a/packages/ui/certd-server/src/controller/basic/code-controller.ts b/packages/ui/certd-server/src/controller/basic/code-controller.ts index c1b97934f..6ac3ade59 100644 --- a/packages/ui/certd-server/src/controller/basic/code-controller.ts +++ b/packages/ui/certd-server/src/controller/basic/code-controller.ts @@ -53,13 +53,13 @@ export class BasicController extends BaseController { @Inject() addonGetterService: AddonGetterService; - @Post('/captcha/get', { summary: Constants.per.guest }) + @Post('/captcha/get', { description: Constants.per.guest }) async getCaptcha(@Query("captchaAddonId") captchaAddonId:number) { const form = await this.captchaService.getCaptcha(captchaAddonId) return this.ok(form); } - @Post('/sendSmsCode', { summary: Constants.per.guest }) + @Post('/sendSmsCode', { description: Constants.per.guest }) public async sendSmsCode( @Body(ALL) body: SmsCodeReq, @@ -80,7 +80,7 @@ export class BasicController extends BaseController { return this.ok(null); } - @Post('/sendEmailCode', { summary: Constants.per.guest }) + @Post('/sendEmailCode', { description: Constants.per.guest }) public async sendEmailCode( @Body(ALL) body: EmailCodeReq, diff --git a/packages/ui/certd-server/src/controller/basic/file-controller.ts b/packages/ui/certd-server/src/controller/basic/file-controller.ts index 13835854a..d2dca2acd 100644 --- a/packages/ui/certd-server/src/controller/basic/file-controller.ts +++ b/packages/ui/certd-server/src/controller/basic/file-controller.ts @@ -13,7 +13,7 @@ export class FileController extends BaseController { @Inject() fileService: FileService; - @Post('/upload', { summary: Constants.per.authOnly }) + @Post('/upload', { description: Constants.per.authOnly }) async upload(@Files() files: UploadFileInfo[], @Fields() fields: any) { console.log('files', files, fields); const cacheKey = uploadTmpFileCacheKey + nanoid(); @@ -33,7 +33,7 @@ export class FileController extends BaseController { }); } - @Get('/download', { summary: Constants.per.guest }) + @Get('/download', { description: Constants.per.guest }) async download(@Query('key') key: string) { let userId: any = null; if (!key.startsWith('/public')) { diff --git a/packages/ui/certd-server/src/controller/basic/health-controller.ts b/packages/ui/certd-server/src/controller/basic/health-controller.ts index 569015007..11aabee79 100644 --- a/packages/ui/certd-server/src/controller/basic/health-controller.ts +++ b/packages/ui/certd-server/src/controller/basic/health-controller.ts @@ -8,12 +8,12 @@ import {BaseController, Constants} from '@certd/lib-server'; export class HealthController extends BaseController { - @Get('/liveliness', { summary: Constants.per.guest }) + @Get('/liveliness', { description: Constants.per.guest }) async liveliness(): Promise { return this.ok('ok') } - @Get('/readiness', { summary: Constants.per.guest }) + @Get('/readiness', { description: Constants.per.guest }) async readiness(): Promise { return this.ok('ok') } diff --git a/packages/ui/certd-server/src/controller/basic/home-controller.ts b/packages/ui/certd-server/src/controller/basic/home-controller.ts index bbb1d84b6..99f619264 100644 --- a/packages/ui/certd-server/src/controller/basic/home-controller.ts +++ b/packages/ui/certd-server/src/controller/basic/home-controller.ts @@ -7,7 +7,7 @@ import { Constants } from '@certd/lib-server'; export class HomeController { @Inject() environmentService: MidwayEnvironmentService; - @Get('/', { summary: Constants.per.guest }) + @Get('/', { description: Constants.per.guest }) async home(): Promise { logger.info('当前环境:', this.environmentService.getCurrentEnvironment()); // prod return 'Hello Midwayjs!'; diff --git a/packages/ui/certd-server/src/controller/basic/login/forgot-password-controller.ts b/packages/ui/certd-server/src/controller/basic/login/forgot-password-controller.ts index bee8bfdcc..8ad6f42de 100644 --- a/packages/ui/certd-server/src/controller/basic/login/forgot-password-controller.ts +++ b/packages/ui/certd-server/src/controller/basic/login/forgot-password-controller.ts @@ -19,7 +19,7 @@ export class ForgotPasswordController extends BaseController { @Inject() sysSettingsService: SysSettingsService; - @Post('/forgotPassword', { summary: Constants.per.guest }) + @Post('/forgotPassword', { description: Constants.per.guest }) public async forgotPassword( @Body(ALL) body: any, diff --git a/packages/ui/certd-server/src/controller/basic/login/login-controller.ts b/packages/ui/certd-server/src/controller/basic/login/login-controller.ts index 4bf11b43d..5cb728ea3 100644 --- a/packages/ui/certd-server/src/controller/basic/login/login-controller.ts +++ b/packages/ui/certd-server/src/controller/basic/login/login-controller.ts @@ -28,7 +28,7 @@ export class LoginController extends BaseController { passkeyService: PasskeyService; - @Post('/login', { summary: Constants.per.guest }) + @Post('/login', { description: Constants.per.guest }) public async login( @Body(ALL) body: any, @@ -48,7 +48,7 @@ export class LoginController extends BaseController { // this.loginService.writeTokenCookie(this.ctx,token); } - @Post('/loginBySms', { summary: Constants.per.guest }) + @Post('/loginBySms', { description: Constants.per.guest }) public async loginBySms( @Body(ALL) body: any @@ -71,7 +71,7 @@ export class LoginController extends BaseController { return this.ok(token); } - @Post('/loginByTwoFactor', { summary: Constants.per.guest }) + @Post('/loginByTwoFactor', { description: Constants.per.guest }) public async loginByTwoFactor( @Body(ALL) body: any @@ -89,7 +89,7 @@ export class LoginController extends BaseController { - @Post('/passkey/generateAuthentication', { summary: Constants.per.guest }) + @Post('/passkey/generateAuthentication', { description: Constants.per.guest }) public async generateAuthentication() { const options = await this.passkeyService.generateAuthenticationOptions( this.ctx @@ -100,7 +100,7 @@ export class LoginController extends BaseController { }); } - @Post('/loginByPasskey', { summary: Constants.per.guest }) + @Post('/loginByPasskey', { description: Constants.per.guest }) public async loginByPasskey( @Body(ALL) body: any @@ -117,7 +117,7 @@ export class LoginController extends BaseController { return this.ok(token); } - @Post('/logout', { summary: Constants.per.authOnly }) + @Post('/logout', { description: Constants.per.authOnly }) public logout() { this.ctx.cookies.set("certd_token", "", { maxAge: 0 diff --git a/packages/ui/certd-server/src/controller/basic/login/oauth-controller.ts b/packages/ui/certd-server/src/controller/basic/login/oauth-controller.ts index 0933bf0d7..ad0e9dd7a 100644 --- a/packages/ui/certd-server/src/controller/basic/login/oauth-controller.ts +++ b/packages/ui/certd-server/src/controller/basic/login/oauth-controller.ts @@ -53,7 +53,7 @@ export class ConnectController extends BaseController { return addon as IOauthProvider; } - @Post('/login', { summary: Constants.per.guest }) + @Post('/login', { description: Constants.per.guest }) public async login(@Body(ALL) body: { type: string, forType?:string ,from?:string }) { const addon = await this.getOauthProvider(body.type); @@ -72,7 +72,7 @@ export class ConnectController extends BaseController { } - @Get('/callback/:type', { summary: Constants.per.guest }) + @Get('/callback/:type', { description: Constants.per.guest }) public async callback(@Param('type') type: string, @Query() query: Record) { checkPlus() @@ -123,7 +123,7 @@ export class ConnectController extends BaseController { } - @Post('/getLogoutUrl', { summary: Constants.per.guest }) + @Post('/getLogoutUrl', { description: Constants.per.guest }) public async logout(@Body(ALL) body: any) { checkPlus() const addon = await this.getOauthProvider(body.type); @@ -132,7 +132,7 @@ export class ConnectController extends BaseController { } - @Post('/token', { summary: Constants.per.guest }) + @Post('/token', { description: Constants.per.guest }) public async token(@Body(ALL) body: { validationCode: string, type: string }) { checkPlus() const validationValue = await this.codeService.getValidationValue(body.validationCode); @@ -166,7 +166,7 @@ export class ConnectController extends BaseController { } - @Post('/autoRegister', { summary: Constants.per.guest }) + @Post('/autoRegister', { description: Constants.per.guest }) public async autoRegister(@Body(ALL) body: { validationCode: string, type: string }) { const validationValue = this.codeService.getValidationValue(body.validationCode); @@ -195,7 +195,7 @@ export class ConnectController extends BaseController { } - @Post('/bind', { summary: Constants.per.loginOnly }) + @Post('/bind', { description: Constants.per.loginOnly }) public async bind(@Body(ALL) body: any) { //需要已登录 const userId = this.getUserId(); @@ -214,7 +214,7 @@ export class ConnectController extends BaseController { return this.ok(1); } - @Post('/unbind', { summary: Constants.per.loginOnly }) + @Post('/unbind', { description: Constants.per.loginOnly }) public async unbind(@Body(ALL) body: any) { //需要已登录 const userId = this.getUserId(); @@ -225,7 +225,7 @@ export class ConnectController extends BaseController { return this.ok(1); } - @Post('/bounds', { summary: Constants.per.loginOnly }) + @Post('/bounds', { description: Constants.per.loginOnly }) public async bounds(@Body(ALL) body: any) { //需要已登录 const userId = this.getUserId(); @@ -238,7 +238,7 @@ export class ConnectController extends BaseController { } - @Post('/providers', { summary: Constants.per.guest }) + @Post('/providers', { description: Constants.per.guest }) public async providers() { const defineList = addonRegistry.getDefineList("oauth"); diff --git a/packages/ui/certd-server/src/controller/basic/login/register-controller.ts b/packages/ui/certd-server/src/controller/basic/login/register-controller.ts index a33d0ba59..ebb604dbc 100644 --- a/packages/ui/certd-server/src/controller/basic/login/register-controller.ts +++ b/packages/ui/certd-server/src/controller/basic/login/register-controller.ts @@ -29,7 +29,7 @@ export class RegisterController extends BaseController { @Inject() sysSettingsService: SysSettingsService; - @Post('/register', { summary: Constants.per.guest }) + @Post('/register', { description: Constants.per.guest }) public async register( @Body(ALL) body: RegisterReq, diff --git a/packages/ui/certd-server/src/controller/basic/root-controller.ts b/packages/ui/certd-server/src/controller/basic/root-controller.ts index ab45671ad..cda4f3806 100644 --- a/packages/ui/certd-server/src/controller/basic/root-controller.ts +++ b/packages/ui/certd-server/src/controller/basic/root-controller.ts @@ -6,7 +6,7 @@ import { Constants, SysSettingsService } from '@certd/lib-server'; export class HomeController { @Inject() sysSettingsService: SysSettingsService; - @Get('/robots.txt', { summary: Constants.per.guest }) + @Get('/robots.txt', { description: Constants.per.guest }) async robots(): Promise { const publicSettings = await this.sysSettingsService.getPublicSettings(); if (!publicSettings.robots) { diff --git a/packages/ui/certd-server/src/controller/basic/settings-controller.ts b/packages/ui/certd-server/src/controller/basic/settings-controller.ts index 006463202..a83fb8fdc 100644 --- a/packages/ui/certd-server/src/controller/basic/settings-controller.ts +++ b/packages/ui/certd-server/src/controller/basic/settings-controller.ts @@ -71,7 +71,7 @@ export class BasicSettingsController extends BaseController { return copy; } - @Get("/productInfo", { summary: Constants.per.guest }) + @Get("/productInfo", { description: Constants.per.guest }) async getProductInfo() { const info = await http.request({ url: "https://app.handfree.work/certd/info.json" @@ -80,7 +80,7 @@ export class BasicSettingsController extends BaseController { } - @Get("/all", { summary: Constants.per.guest }) + @Get("/all", { description: Constants.per.guest }) async getAllSettings() { const sysPublic = await this.getSysPublic(); const installInfo = await this.getInstallInfo(); diff --git a/packages/ui/certd-server/src/controller/basic/unhidden-controller.ts b/packages/ui/certd-server/src/controller/basic/unhidden-controller.ts index f46e6989d..dae436072 100644 --- a/packages/ui/certd-server/src/controller/basic/unhidden-controller.ts +++ b/packages/ui/certd-server/src/controller/basic/unhidden-controller.ts @@ -32,7 +32,7 @@ export class UnhiddenController { sysSettingsService: SysSettingsService; - @Post('/:randomPath', {summary: Constants.per.guest}) + @Post('/:randomPath', {description: Constants.per.guest}) async randomPath(@Body("password") password: any) { await this.checkUnhiddenPath() const hiddenSetting = await this.safeService.getHiddenSetting() @@ -50,7 +50,7 @@ export class UnhiddenController { } } - @Get('/:randomPath', {summary: Constants.per.guest}) + @Get('/:randomPath', {description: Constants.per.guest}) async unhiddenGet() { await this.checkUnhiddenPath() this.ctx.response.body = unhiddenHtml diff --git a/packages/ui/certd-server/src/controller/basic/webhook-controller.ts b/packages/ui/certd-server/src/controller/basic/webhook-controller.ts index 19173ff2c..cd5825afb 100644 --- a/packages/ui/certd-server/src/controller/basic/webhook-controller.ts +++ b/packages/ui/certd-server/src/controller/basic/webhook-controller.ts @@ -10,8 +10,8 @@ export class WebhookController extends BaseController { @Inject() pipelineService: PipelineService; - @Get('/:webhookKey', { summary: Constants.per.guest }) - @Post('/:webhookKey', { summary: Constants.per.guest }) + @Get('/:webhookKey', { description: Constants.per.guest }) + @Post('/:webhookKey', { description: Constants.per.guest }) async webhook(@Param('webhookKey') webhookKey: string): Promise { await this.pipelineService.triggerByWebhook(webhookKey); return this.ok({}); diff --git a/packages/ui/certd-server/src/controller/openapi/v1/cert-controller.ts b/packages/ui/certd-server/src/controller/openapi/v1/cert-controller.ts index a57e22dc8..8a26a959d 100644 --- a/packages/ui/certd-server/src/controller/openapi/v1/cert-controller.ts +++ b/packages/ui/certd-server/src/controller/openapi/v1/cert-controller.ts @@ -25,8 +25,8 @@ export class OpenCertController extends BaseOpenController { @Inject() encryptService: EncryptService; - @Get('/get', { summary: Constants.per.open }) - @Post('/get', { summary: Constants.per.open }) + @Get('/get', { description: Constants.per.open }) + @Post('/get', { description: Constants.per.open }) async get(@Body(ALL) bean: CertGetReq, @Query(ALL) query: CertGetReq) { const openKey: OpenKey = this.ctx.openKey; const userId = openKey.userId; diff --git a/packages/ui/certd-server/src/controller/sys/access/access-controller.ts b/packages/ui/certd-server/src/controller/sys/access/access-controller.ts index d069c38a5..ee0184ef6 100644 --- a/packages/ui/certd-server/src/controller/sys/access/access-controller.ts +++ b/packages/ui/certd-server/src/controller/sys/access/access-controller.ts @@ -26,57 +26,57 @@ export class SysAccessController extends AccessController { return 0; } - @Post('/page', { summary: 'sys:settings:view' }) + @Post('/page', { description: 'sys:settings:view' }) async page(@Body(ALL) body: any) { return await super.page(body); } - @Post('/list', { summary: 'sys:settings:view' }) + @Post('/list', { description: 'sys:settings:view' }) async list(@Body(ALL) body: any) { return await super.list(body); } - @Post('/add', { summary: 'sys:settings:edit' }) + @Post('/add', { description: 'sys:settings:edit' }) async add(@Body(ALL) bean: any) { return await super.add(bean); } - @Post('/update', { summary: 'sys:settings:edit' }) + @Post('/update', { description: 'sys:settings:edit' }) async update(@Body(ALL) bean: any) { return await super.update(bean); } - @Post('/info', { summary: 'sys:settings:view' }) + @Post('/info', { description: 'sys:settings:view' }) async info(@Query('id') id: number) { return await super.info(id); } - @Post('/delete', { summary: 'sys:settings:edit' }) + @Post('/delete', { description: 'sys:settings:edit' }) async delete(@Query('id') id: number) { return await super.delete(id); } - @Post('/define', { summary: 'sys:settings:view' }) + @Post('/define', { description: 'sys:settings:view' }) async define(@Query('type') type: string) { return await super.define(type); } - @Post('/getSecretPlain', { summary: 'sys:settings:view' }) + @Post('/getSecretPlain', { description: 'sys:settings:view' }) async getSecretPlain(@Body(ALL) body: { id: number; key: string }) { const value = await this.service.getById(body.id, 0); return this.ok(value[body.key]); } - @Post('/accessTypeDict', { summary: 'sys:settings:view' }) + @Post('/accessTypeDict', { description: 'sys:settings:view' }) async getAccessTypeDict() { return await super.getAccessTypeDict(); } - @Post('/simpleInfo', { summary: 'sys:settings:view' }) + @Post('/simpleInfo', { description: 'sys:settings:view' }) async simpleInfo(@Query('id') id: number) { return await super.simpleInfo(id); } - @Post('/getDictByIds', { summary: 'sys:settings:view' }) + @Post('/getDictByIds', { description: 'sys:settings:view' }) async getDictByIds(@Body('ids') ids: number[]) { return await super.getDictByIds(ids); } diff --git a/packages/ui/certd-server/src/controller/sys/account/account-controller.ts b/packages/ui/certd-server/src/controller/sys/account/account-controller.ts index 3af8074d1..77dcf6c50 100644 --- a/packages/ui/certd-server/src/controller/sys/account/account-controller.ts +++ b/packages/ui/certd-server/src/controller/sys/account/account-controller.ts @@ -18,7 +18,7 @@ export class BasicController extends BaseController { @Inject() sysSettingsService: SysSettingsService; - @Post('/preBindUser', { summary: 'sys:settings:edit' }) + @Post('/preBindUser', { description: 'sys:settings:edit' }) public async preBindUser(@Body(ALL) body: PreBindUserReq) { // 设置缓存内容 if (body.userId == null || body.userId <= 0) { @@ -28,7 +28,7 @@ export class BasicController extends BaseController { return this.ok({}); } - @Post('/bindUser', { summary: 'sys:settings:edit' }) + @Post('/bindUser', { description: 'sys:settings:edit' }) public async bindUser(@Body(ALL) body: BindUserReq) { if (body.userId == null || body.userId <= 0) { throw new Error("用户ID不能为空"); @@ -39,7 +39,7 @@ export class BasicController extends BaseController { return this.ok({}); } - @Post('/unbindUser', { summary: 'sys:settings:edit' }) + @Post('/unbindUser', { description: 'sys:settings:edit' }) public async unbindUser() { const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo); installInfo.bindUserId = null; @@ -47,7 +47,7 @@ export class BasicController extends BaseController { return this.ok({}); } - @Post('/updateLicense', { summary: 'sys:settings:edit' }) + @Post('/updateLicense', { description: 'sys:settings:edit' }) public async updateLicense(@Body(ALL) body: { license: string }) { await this.plusService.updateLicense(body.license); return this.ok(true); diff --git a/packages/ui/certd-server/src/controller/sys/addon/addon-controller.ts b/packages/ui/certd-server/src/controller/sys/addon/addon-controller.ts index 9ec28035f..229a9ee95 100644 --- a/packages/ui/certd-server/src/controller/sys/addon/addon-controller.ts +++ b/packages/ui/certd-server/src/controller/sys/addon/addon-controller.ts @@ -22,66 +22,66 @@ export class SysAddonController extends AddonController { return 0; } - @Post('/page', { summary: 'sys:settings:view' }) + @Post('/page', { description: 'sys:settings:view' }) async page(@Body(ALL) body: any) { return await super.page(body); } - @Post('/list', { summary: 'sys:settings:view' }) + @Post('/list', { description: 'sys:settings:view' }) async list(@Body(ALL) body: any) { return await super.list(body); } - @Post('/add', { summary: 'sys:settings:edit' }) + @Post('/add', { description: 'sys:settings:edit' }) async add(@Body(ALL) bean: any) { return await super.add(bean); } - @Post('/update', { summary: 'sys:settings:edit' }) + @Post('/update', { description: 'sys:settings:edit' }) async update(@Body(ALL) bean: any) { return await super.update(bean); } - @Post('/info', { summary: 'sys:settings:view' }) + @Post('/info', { description: 'sys:settings:view' }) async info(@Query('id') id: number) { return await super.info(id); } - @Post('/delete', { summary: 'sys:settings:edit' }) + @Post('/delete', { description: 'sys:settings:edit' }) async delete(@Query('id') id: number) { return await super.delete(id); } - @Post('/define', { summary: Constants.per.authOnly }) + @Post('/define', { description: Constants.per.authOnly }) async define(@Query('type') type: string,@Query('addonType') addonType: string) { return await super.define(type,addonType); } - @Post('/getTypeDict', { summary: Constants.per.authOnly }) + @Post('/getTypeDict', { description: Constants.per.authOnly }) async getTypeDict(@Query('addonType') addonType: string) { return await super.getTypeDict(addonType); } - @Post('/simpleInfo', { summary: Constants.per.authOnly }) + @Post('/simpleInfo', { description: Constants.per.authOnly }) async simpleInfo(@Query('addonType') addonType: string,@Query('id') id: number) { return await super.simpleInfo(addonType,id); } - @Post('/getDefaultId', { summary: Constants.per.authOnly }) + @Post('/getDefaultId', { description: Constants.per.authOnly }) async getDefaultId(@Query('addonType') addonType: string) { return await super.getDefaultId(addonType); } - @Post('/setDefault', { summary: Constants.per.authOnly }) + @Post('/setDefault', { description: Constants.per.authOnly }) async setDefault(@Query('addonType') addonType: string,@Query('id') id: number) { return await super.setDefault(addonType,id); } - @Post('/options', { summary: Constants.per.authOnly }) + @Post('/options', { description: Constants.per.authOnly }) async options(@Query('addonType') addonType: string) { return await super.options(addonType); } - @Post('/handle', { summary: Constants.per.authOnly }) + @Post('/handle', { description: Constants.per.authOnly }) async handle(@Body(ALL) body: AddonRequestHandleReq) { return await super.handle(body); } diff --git a/packages/ui/certd-server/src/controller/sys/authority/permission-controller.ts b/packages/ui/certd-server/src/controller/sys/authority/permission-controller.ts index d04376df4..ba09a6a38 100644 --- a/packages/ui/certd-server/src/controller/sys/authority/permission-controller.ts +++ b/packages/ui/certd-server/src/controller/sys/authority/permission-controller.ts @@ -15,7 +15,7 @@ export class PermissionController extends CrudController { return this.service; } - @Post('/page', { summary: 'sys:auth:per:view' }) + @Post('/page', { description: 'sys:auth:per:view' }) async page( @Body(ALL) body @@ -23,7 +23,7 @@ export class PermissionController extends CrudController { return await super.page(body); } - @Post('/add', { summary: 'sys:auth:per:add' }) + @Post('/add', { description: 'sys:auth:per:add' }) async add( @Body(ALL) bean @@ -31,14 +31,14 @@ export class PermissionController extends CrudController { return await super.add(bean); } - @Post('/update', { summary: 'sys:auth:per:edit' }) + @Post('/update', { description: 'sys:auth:per:edit' }) async update( @Body(ALL) bean ) { return await super.update(bean); } - @Post('/delete', { summary: 'sys:auth:per:remove' }) + @Post('/delete', { description: 'sys:auth:per:remove' }) async delete( @Query('id') id: number @@ -46,7 +46,7 @@ export class PermissionController extends CrudController { return await super.delete(id); } - @Post('/tree', { summary: 'sys:auth:per:view' }) + @Post('/tree', { description: 'sys:auth:per:view' }) async tree() { const tree = await this.service.tree({}); return this.ok(tree); diff --git a/packages/ui/certd-server/src/controller/sys/authority/role-controller.ts b/packages/ui/certd-server/src/controller/sys/authority/role-controller.ts index debb3bfcb..e76943f33 100644 --- a/packages/ui/certd-server/src/controller/sys/authority/role-controller.ts +++ b/packages/ui/certd-server/src/controller/sys/authority/role-controller.ts @@ -15,7 +15,7 @@ export class RoleController extends CrudController { return this.service; } - @Post('/page', { summary: 'sys:auth:role:view' }) + @Post('/page', { description: 'sys:auth:role:view' }) async page( @Body(ALL) body @@ -23,13 +23,13 @@ export class RoleController extends CrudController { return await super.page(body); } - @Post('/list', { summary: 'sys:auth:role:view' }) + @Post('/list', { description: 'sys:auth:role:view' }) async list() { const ret = await this.service.find({}); return this.ok(ret); } - @Post('/add', { summary: 'sys:auth:role:add' }) + @Post('/add', { description: 'sys:auth:role:add' }) async add( @Body(ALL) bean @@ -37,14 +37,14 @@ export class RoleController extends CrudController { return await super.add(bean); } - @Post('/update', { summary: 'sys:auth:role:edit' }) + @Post('/update', { description: 'sys:auth:role:edit' }) async update( @Body(ALL) bean ) { return await super.update(bean); } - @Post('/delete', { summary: 'sys:auth:role:remove' }) + @Post('/delete', { description: 'sys:auth:role:remove' }) async delete( @Query('id') id: number @@ -55,7 +55,7 @@ export class RoleController extends CrudController { return await super.delete(id); } - @Post('/getPermissionTree', { summary: 'sys:auth:role:view' }) + @Post('/getPermissionTree', { description: 'sys:auth:role:view' }) async getPermissionTree( @Query('id') id: number @@ -64,7 +64,7 @@ export class RoleController extends CrudController { return this.ok(ret); } - @Post('/getPermissionIds', { summary: 'sys:auth:role:view' }) + @Post('/getPermissionIds', { description: 'sys:auth:role:view' }) async getPermissionIds( @Query('id') id: number @@ -78,7 +78,7 @@ export class RoleController extends CrudController { * @param roleId * @param permissionIds */ - @Post('/authz', { summary: 'sys:auth:role:edit' }) + @Post('/authz', { description: 'sys:auth:role:edit' }) async authz(@Body('roleId') roleId, @Body('permissionIds') permissionIds) { await this.service.authz(roleId, permissionIds); return this.ok(null); diff --git a/packages/ui/certd-server/src/controller/sys/authority/user-controller.ts b/packages/ui/certd-server/src/controller/sys/authority/user-controller.ts index c37ed60a6..1faf30334 100644 --- a/packages/ui/certd-server/src/controller/sys/authority/user-controller.ts +++ b/packages/ui/certd-server/src/controller/sys/authority/user-controller.ts @@ -28,7 +28,7 @@ export class UserController extends CrudController { return this.service; } - @Post('/getSimpleUserByIds', {summary: 'sys:auth:user:view'}) + @Post('/getSimpleUserByIds', {description: 'sys:auth:user:view'}) async getSimpleUserByIds(@Body('ids') ids: number[]) { const users = await this.service.find({ select: { @@ -47,7 +47,7 @@ export class UserController extends CrudController { } - @Post('/getSimpleUsers', {summary: 'sys:auth:user:view'}) + @Post('/getSimpleUsers', {description: 'sys:auth:user:view'}) async getSimpleUsers() { const users = await this.service.find({ select: { @@ -61,7 +61,7 @@ export class UserController extends CrudController { return this.ok(users); } - @Post('/page', {summary: 'sys:auth:user:view'}) + @Post('/page', {description: 'sys:auth:user:view'}) async page( @Body(ALL) body @@ -93,7 +93,7 @@ export class UserController extends CrudController { return ret; } - @Post('/add', {summary: 'sys:auth:user:add'}) + @Post('/add', {description: 'sys:auth:user:add'}) async add( @Body(ALL) bean @@ -101,7 +101,7 @@ export class UserController extends CrudController { return await super.add(bean); } - @Post('/update', {summary: 'sys:auth:user:edit'}) + @Post('/update', {description: 'sys:auth:user:edit'}) async update( @Body(ALL) bean @@ -109,7 +109,7 @@ export class UserController extends CrudController { return await super.update(bean); } - @Post('/delete', {summary: 'sys:auth:user:remove'}) + @Post('/delete', {description: 'sys:auth:user:remove'}) async delete( @Query('id') id: number @@ -126,7 +126,7 @@ export class UserController extends CrudController { /** * 解除登录锁定 */ - @Post('/unlockBlock', {summary: "sys:auth:user:edit"}) + @Post('/unlockBlock', {description: "sys:auth:user:edit"}) public async unlockBlock(@Body('id') id: number) { const info = await this.service.info(id, ['password']); this.loginService.clearCacheOnSuccess(info.username) @@ -139,7 +139,7 @@ export class UserController extends CrudController { /** * 当前登录用户的个人信息 */ - @Post('/mine', {summary: Constants.per.authOnly}) + @Post('/mine', {description: Constants.per.authOnly}) public async mine() { const id = this.getUserId(); const info = await this.service.info(id, ['password']); @@ -149,7 +149,7 @@ export class UserController extends CrudController { /** * 当前登录用户的权限列表 */ - @Post('/permissions', {summary: Constants.per.authOnly}) + @Post('/permissions', {description: Constants.per.authOnly}) public async permissions() { const id = this.getUserId(); const permissions = await this.service.getUserPermissions(id); @@ -159,7 +159,7 @@ export class UserController extends CrudController { /** * 当前登录用户的权限树形列表 */ - @Post('/permissionTree', {summary: Constants.per.authOnly}) + @Post('/permissionTree', {description: Constants.per.authOnly}) public async permissionTree() { const id = this.getUserId(); const permissions = await this.service.getUserPermissions(id); diff --git a/packages/ui/certd-server/src/controller/sys/cname/cname-provider-controller.ts b/packages/ui/certd-server/src/controller/sys/cname/cname-provider-controller.ts index 2559045f1..9ba057cb9 100644 --- a/packages/ui/certd-server/src/controller/sys/cname/cname-provider-controller.ts +++ b/packages/ui/certd-server/src/controller/sys/cname/cname-provider-controller.ts @@ -16,18 +16,18 @@ export class CnameRecordController extends CrudController return this.service; } - @Post('/page', { summary: 'sys:settings:view' }) + @Post('/page', { description: 'sys:settings:view' }) async page(@Body(ALL) body: any) { body.query = body.query ?? {}; return await super.page(body); } - @Post('/list', { summary: 'sys:settings:view' }) + @Post('/list', { description: 'sys:settings:view' }) async list(@Body(ALL) body: any) { return super.list(body); } - @Post('/add', { summary: 'sys:settings:edit' }) + @Post('/add', { description: 'sys:settings:edit' }) async add(@Body(ALL) bean: any) { const def: any = { isDefault: false, @@ -38,35 +38,35 @@ export class CnameRecordController extends CrudController return super.add(bean); } - @Post('/update', { summary: 'sys:settings:edit' }) + @Post('/update', { description: 'sys:settings:edit' }) async update(@Body(ALL) bean: any) { bean.userId = this.getUserId(); return super.update(bean); } - @Post('/info', { summary: 'sys:settings:view' }) + @Post('/info', { description: 'sys:settings:view' }) async info(@Query('id') id: number) { return super.info(id); } - @Post('/delete', { summary: 'sys:settings:edit' }) + @Post('/delete', { description: 'sys:settings:edit' }) async delete(@Query('id') id: number) { return super.delete(id); } - @Post('/deleteByIds', { summary: 'sys:settings:edit' }) + @Post('/deleteByIds', { description: 'sys:settings:edit' }) async deleteByIds(@Body('ids') ids: number[]) { const res = await this.service.delete(ids); return this.ok(res); } - @Post('/setDefault', { summary: 'sys:settings:edit' }) + @Post('/setDefault', { description: 'sys:settings:edit' }) async setDefault(@Body('id') id: number) { await this.service.setDefault(id); return this.ok(); } - @Post('/setDisabled', { summary: 'sys:settings:edit' }) + @Post('/setDisabled', { description: 'sys:settings:edit' }) async setDisabled(@Body('id') id: number, @Body('disabled') disabled: boolean) { await this.service.setDisabled(id, disabled); return this.ok(); diff --git a/packages/ui/certd-server/src/controller/sys/console/statistic-controller.ts b/packages/ui/certd-server/src/controller/sys/console/statistic-controller.ts index 1b6d39e03..cedc9fac9 100644 --- a/packages/ui/certd-server/src/controller/sys/console/statistic-controller.ts +++ b/packages/ui/certd-server/src/controller/sys/console/statistic-controller.ts @@ -31,7 +31,7 @@ export class SysStatisticController extends BaseController { @Inject() historyService: HistoryService; - @Post('/count', { summary: 'sys:settings:view' }) + @Post('/count', { description: 'sys:settings:view' }) public async count() { const userCount = await this.userService.count(); const userRegisterCountPerDay = await this.userService.registerCountPerDay({ days: 7 }); diff --git a/packages/ui/certd-server/src/controller/sys/enterprise/project-controller.ts b/packages/ui/certd-server/src/controller/sys/enterprise/project-controller.ts index 73ae7c689..a37cb2ba6 100644 --- a/packages/ui/certd-server/src/controller/sys/enterprise/project-controller.ts +++ b/packages/ui/certd-server/src/controller/sys/enterprise/project-controller.ts @@ -19,18 +19,18 @@ export class SysProjectController extends CrudController { return this.service; } - @Post("/page", { summary: "sys:settings:view" }) + @Post("/page", { description: "sys:settings:view" }) async page(@Body(ALL) body: any) { body.query = body.query ?? {}; return await super.page(body); } - @Post("/list", { summary: "sys:settings:view" }) + @Post("/list", { description: "sys:settings:view" }) async list(@Body(ALL) body: any) { return super.list(body); } - @Post("/add", { summary: "sys:settings:edit" }) + @Post("/add", { description: "sys:settings:edit" }) async add(@Body(ALL) bean: any) { const def: any = { isDefault: false, @@ -45,28 +45,28 @@ export class SysProjectController extends CrudController { }); } - @Post("/update", { summary: "sys:settings:edit" }) + @Post("/update", { description: "sys:settings:edit" }) async update(@Body(ALL) bean: any) { bean.userId = this.getUserId(); return super.update(bean); } - @Post("/info", { summary: "sys:settings:view" }) + @Post("/info", { description: "sys:settings:view" }) async info(@Query("id") id: number) { return super.info(id); } - @Post("/delete", { summary: "sys:settings:edit" }) + @Post("/delete", { description: "sys:settings:edit" }) async delete(@Query("id") id: number) { return super.delete(id); } - @Post("/deleteByIds", { summary: "sys:settings:edit" }) + @Post("/deleteByIds", { description: "sys:settings:edit" }) async deleteByIds(@Body("ids") ids: number[]) { const res = await this.service.delete(ids); return this.ok(res); } - @Post("/setDisabled", { summary: "sys:settings:edit" }) + @Post("/setDisabled", { description: "sys:settings:edit" }) async setDisabled(@Body("id") id: number, @Body("disabled") disabled: boolean) { await this.service.setDisabled(id, disabled); return this.ok(); diff --git a/packages/ui/certd-server/src/controller/sys/enterprise/project-member-controller.ts b/packages/ui/certd-server/src/controller/sys/enterprise/project-member-controller.ts index 8ce7e236c..345698559 100644 --- a/packages/ui/certd-server/src/controller/sys/enterprise/project-member-controller.ts +++ b/packages/ui/certd-server/src/controller/sys/enterprise/project-member-controller.ts @@ -23,18 +23,18 @@ export class SysProjectMemberController extends CrudController { return this.service; } - @Post('/page', { summary: 'sys:settings:view' }) + @Post('/page', { description: 'sys:settings:view' }) async page(@Body(ALL) body: any) { body.query = body.query ?? {}; return await super.page(body); } - @Post('/list', { summary: 'sys:settings:view' }) + @Post('/list', { description: 'sys:settings:view' }) async list(@Body(ALL) body: any) { return super.list(body); } - @Post('/add', { summary: 'sys:settings:edit' }) + @Post('/add', { description: 'sys:settings:edit' }) async add(@Body(ALL) bean: any) { const def: any = { isDefault: false, @@ -44,58 +44,58 @@ export class PluginController extends CrudController { return super.add(bean); } - @Post('/update', { summary: 'sys:settings:edit' }) + @Post('/update', { description: 'sys:settings:edit' }) async update(@Body(ALL) bean: any) { const res = await super.update(bean); return res } - @Post('/info', { summary: 'sys:settings:view' }) + @Post('/info', { description: 'sys:settings:view' }) async info(@Query('id') id: number) { return super.info(id); } - @Post('/delete', { summary: 'sys:settings:edit' }) + @Post('/delete', { description: 'sys:settings:edit' }) async delete(@Query('id') id: number) { return super.deleteByIds([id]); } - @Post('/deleteByIds', { summary: 'sys:settings:edit' }) + @Post('/deleteByIds', { description: 'sys:settings:edit' }) async deleteByIds(@Body('ids') ids: number[]) { const res = await this.service.deleteByIds(ids); return this.ok(res); } - @Post('/setDisabled', { summary: 'sys:settings:edit' }) + @Post('/setDisabled', { description: 'sys:settings:edit' }) async setDisabled(@Body(ALL) body: { id: number; name: string; type: string; disabled: boolean }) { await this.service.setDisabled(body); return this.ok(); } - @Post('/getCommPluginConfigs', { summary: 'sys:settings:view' }) + @Post('/getCommPluginConfigs', { description: 'sys:settings:view' }) async getCommPluginConfigs() { const res = await this.pluginConfigService.getCommPluginConfig(); return this.ok(res); } - @Post('/saveCommPluginConfigs', { summary: 'sys:settings:edit' }) + @Post('/saveCommPluginConfigs', { description: 'sys:settings:edit' }) async saveCommPluginConfigs(@Body(ALL) body: CommPluginConfig) { const res = await this.pluginConfigService.saveCommPluginConfig(body); return this.ok(res); } - @Post('/saveSetting', { summary: 'sys:settings:edit' }) + @Post('/saveSetting', { description: 'sys:settings:edit' }) async saveSetting(@Body(ALL) body: PluginConfig) { const res = await this.pluginConfigService.savePluginConfig(body); return this.ok(res); } - @Post('/import', { summary: 'sys:settings:edit' }) + @Post('/import', { description: 'sys:settings:edit' }) async import(@Body(ALL) body: PluginImportReq) { const res = await this.service.importPlugin(body); return this.ok(res); } - @Post('/export', { summary: 'sys:settings:edit' }) + @Post('/export', { description: 'sys:settings:edit' }) async export(@Body('id') id: number) { const res = await this.service.exportPlugin(id); return this.ok(res); diff --git a/packages/ui/certd-server/src/controller/sys/plus/plus-controller.ts b/packages/ui/certd-server/src/controller/sys/plus/plus-controller.ts index fb617a1fc..adb1b8390 100644 --- a/packages/ui/certd-server/src/controller/sys/plus/plus-controller.ts +++ b/packages/ui/certd-server/src/controller/sys/plus/plus-controller.ts @@ -13,7 +13,7 @@ export class SysPlusController extends BaseController { @Inject() plusService: PlusService; - @Post('/active', { summary: 'sys:settings:edit' }) + @Post('/active', { description: 'sys:settings:edit' }) async active(@Body(ALL) body) { const { code, inviteCode } = body; @@ -21,7 +21,7 @@ export class SysPlusController extends BaseController { return this.ok(true); } - @Post('/bindUrl', { summary: 'sys:settings:edit' }) + @Post('/bindUrl', { description: 'sys:settings:edit' }) async bindUrl(@Body(ALL) body: { url: string ,url2?:string }) { const { url,url2 } = body; await this.plusService.register(); @@ -42,18 +42,18 @@ export class SysPlusController extends BaseController { return this.ok(true); } - @Post('/getVipTrial', { summary: 'sys:settings:edit' }) + @Post('/getVipTrial', { description: 'sys:settings:edit' }) async getVipTrial(@Body("vipType") vipType?:string) { const res = await this.plusService.getVipTrial(vipType); return this.ok(res); } - @Post('/getTodayVipOrderCount', { summary: 'sys:settings:edit' }) + @Post('/getTodayVipOrderCount', { description: 'sys:settings:edit' }) async getTodayVipOrderCount() { const res = await this.plusService.getTodayOrderCount(); return this.ok(res); } // - // @Get('/test', { summary: Constants.per.guest }) + // @Get('/test', { description: Constants.per.guest }) // async test() { // const subjectId = 'xxxxxx'; // const license = ''; diff --git a/packages/ui/certd-server/src/controller/sys/settings/sys-safe-settings-controller.ts b/packages/ui/certd-server/src/controller/sys/settings/sys-safe-settings-controller.ts index 892d08bfd..30053ec07 100644 --- a/packages/ui/certd-server/src/controller/sys/settings/sys-safe-settings-controller.ts +++ b/packages/ui/certd-server/src/controller/sys/settings/sys-safe-settings-controller.ts @@ -14,7 +14,7 @@ export class SysSettingsController extends BaseController { - @Post("/get", { summary: "sys:settings:view" }) + @Post("/get", { description: "sys:settings:view" }) async safeGet() { const res = await this.safeService.getSafeSetting() const clone:SysSafeSetting = cloneDeep(res); @@ -22,7 +22,7 @@ export class SysSettingsController extends BaseController { return this.ok(clone); } - @Post("/save", { summary: "sys:settings:edit" }) + @Post("/save", { description: "sys:settings:edit" }) async safeSave(@Body(ALL) body: any) { await this.safeService.saveSafeSetting(body); return this.ok({}); @@ -31,7 +31,7 @@ export class SysSettingsController extends BaseController { /** * 立即隐藏 */ - @Post("/hidden", { summary: "sys:settings:edit" }) + @Post("/hidden", { description: "sys:settings:edit" }) async hiddenImmediate() { await this.safeService.hiddenImmediately(); return this.ok({}); diff --git a/packages/ui/certd-server/src/controller/sys/settings/sys-settings-controller.ts b/packages/ui/certd-server/src/controller/sys/settings/sys-settings-controller.ts index 96485105b..689746083 100644 --- a/packages/ui/certd-server/src/controller/sys/settings/sys-settings-controller.ts +++ b/packages/ui/certd-server/src/controller/sys/settings/sys-settings-controller.ts @@ -38,58 +38,58 @@ export class SysSettingsController extends CrudController { return this.service; } - @Post('/page', { summary: 'sys:settings:view' }) + @Post('/page', { description: 'sys:settings:view' }) async page(@Body(ALL) body) { return super.page(body); } - @Post('/list', { summary: 'sys:settings:view' }) + @Post('/list', { description: 'sys:settings:view' }) async list(@Body(ALL) body) { return super.list(body); } - @Post('/add', { summary: 'sys:settings:edit' }) + @Post('/add', { description: 'sys:settings:edit' }) async add(@Body(ALL) bean) { return super.add(bean); } - @Post('/update', { summary: 'sys:settings:edit' }) + @Post('/update', { description: 'sys:settings:edit' }) async update(@Body(ALL) bean) { await this.service.checkUserId(bean.id, this.getUserId()); return super.update(bean); } - @Post('/info', { summary: 'sys:settings:view' }) + @Post('/info', { description: 'sys:settings:view' }) async info(@Query('id') id: number) { await this.service.checkUserId(id, this.getUserId()); return super.info(id); } - @Post('/delete', { summary: 'sys:settings:edit' }) + @Post('/delete', { description: 'sys:settings:edit' }) async delete(@Query('id') id: number) { await this.service.checkUserId(id, this.getUserId()); return super.delete(id); } - @Post('/save', { summary: 'sys:settings:edit' }) + @Post('/save', { description: 'sys:settings:edit' }) async save(@Body(ALL) bean: SysSettingsEntity) { await this.service.save(bean); return this.ok({}); } - @Post('/get', { summary: 'sys:settings:view' }) + @Post('/get', { description: 'sys:settings:view' }) async get(@Query('key') key: string) { const entity = await this.service.getByKey(key); return this.ok(entity); } // savePublicSettings - @Post('/getEmailSettings', { summary: 'sys:settings:view' }) + @Post('/getEmailSettings', { description: 'sys:settings:view' }) async getEmailSettings(@Body(ALL) body) { const conf = await getEmailSettings(this.service, this.userSettingsService); return this.ok(conf); } - @Post('/getEmailTemplates', { summary: 'sys:settings:view' }) + @Post('/getEmailTemplates', { description: 'sys:settings:view' }) async getEmailTemplates(@Body(ALL) body) { const conf = await getEmailSettings(this.service, this.userSettingsService); const templates = conf.templates || {} @@ -108,7 +108,7 @@ export class SysSettingsController extends CrudController { return this.ok(proviers); } - @Post('/saveEmailSettings', { summary: 'sys:settings:edit' }) + @Post('/saveEmailSettings', { description: 'sys:settings:edit' }) async saveEmailSettings(@Body(ALL) body) { const conf = await getEmailSettings(this.service, this.userSettingsService); merge(conf, body); @@ -116,7 +116,7 @@ export class SysSettingsController extends CrudController { return this.ok(conf); } - @Post('/getSysSettings', { summary: 'sys:settings:view' }) + @Post('/getSysSettings', { description: 'sys:settings:view' }) async getSysSettings() { const publicSettings = await this.service.getPublicSettings(); let privateSettings = await this.service.getPrivateSettings(); @@ -125,7 +125,7 @@ export class SysSettingsController extends CrudController { } // savePublicSettings - @Post('/saveSysSettings', { summary: 'sys:settings:edit' }) + @Post('/saveSysSettings', { description: 'sys:settings:edit' }) async saveSysSettings(@Body(ALL) body: { public: SysPublicSettings; private: SysPrivateSettings }) { const publicSettings = await this.service.getPublicSettings(); const privateSettings = await this.service.getPrivateSettings(); @@ -135,13 +135,13 @@ export class SysSettingsController extends CrudController { await this.service.savePrivateSettings(privateSettings); return this.ok({}); } - @Post('/stopOtherUserTimer', { summary: 'sys:settings:edit' }) + @Post('/stopOtherUserTimer', { description: 'sys:settings:edit' }) async stopOtherUserTimer(@Body(ALL) body) { await this.pipelineService.stopOtherUserPipeline(1); return this.ok({}); } - @Post('/testProxy', { summary: 'sys:settings:edit' }) + @Post('/testProxy', { description: 'sys:settings:edit' }) async testProxy(@Body(ALL) body) { const google = 'https://www.google.com/'; const baidu = 'https://www.baidu.com/'; @@ -179,13 +179,13 @@ export class SysSettingsController extends CrudController { }); } - @Post('/testSms', { summary: 'sys:settings:edit' }) + @Post('/testSms', { description: 'sys:settings:edit' }) async testSms(@Body(ALL) body) { await this.codeService.sendSmsCode(body.phoneCode, body.mobile ); return this.ok({}); } - @Post('/getSmsTypeDefine', { summary: 'sys:settings:view' }) + @Post('/getSmsTypeDefine', { description: 'sys:settings:view' }) async getSmsTypeDefine(@Body('type') type: string) { const define =await SmsServiceFactory.getDefine(type); return this.ok(define); @@ -193,7 +193,7 @@ export class SysSettingsController extends CrudController { - @Post("/safe/get", { summary: "sys:settings:view" }) + @Post("/safe/get", { description: "sys:settings:view" }) async safeGet() { const res = await this.service.getSetting(SysSafeSetting); const clone:SysSafeSetting = cloneDeep(res); @@ -201,7 +201,7 @@ export class SysSettingsController extends CrudController { return this.ok(clone); } - @Post("/safe/save", { summary: "sys:settings:edit" }) + @Post("/safe/save", { description: "sys:settings:edit" }) async safeSave(@Body(ALL) body: any) { if(body.hidden.openPassword){ body.hidden.openPassword = utils.hash.md5(body.hidden.openPassword); @@ -217,13 +217,13 @@ export class SysSettingsController extends CrudController { } - @Post("/captchaTest", { summary: "sys:settings:edit" }) + @Post("/captchaTest", { description: "sys:settings:edit" }) async captchaTest(@Body(ALL) body: any,@RequestIP() remoteIp: string) { await this.codeService.checkCaptcha(body,{remoteIp}); return this.ok({}); } - @Post('/oauth/providers', { summary: 'sys:settings:view' }) + @Post('/oauth/providers', { description: 'sys:settings:view' }) async oauthProviders() { const list = await addonRegistry.getDefineList("oauth"); return this.ok(list); diff --git a/packages/ui/certd-server/src/controller/user/addon/addon-controller.ts b/packages/ui/certd-server/src/controller/user/addon/addon-controller.ts index 2c1d3ca4c..e092dc095 100644 --- a/packages/ui/certd-server/src/controller/user/addon/addon-controller.ts +++ b/packages/ui/certd-server/src/controller/user/addon/addon-controller.ts @@ -32,7 +32,7 @@ export class AddonController extends CrudController { 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 ?? {}; @@ -50,7 +50,7 @@ export class AddonController extends CrudController { 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 ?? {}; @@ -59,7 +59,7 @@ export class AddonController extends CrudController { 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; @@ -79,7 +79,7 @@ export class AddonController extends CrudController { 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); @@ -102,25 +102,25 @@ export class AddonController extends CrudController { 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, @Query("addonType") addonType: string) { const notification = this.service.getDefineByType(type, addonType); return this.ok(notification); } - @Post("/getTypeDict", { summary: Constants.per.authOnly }) + @Post("/getTypeDict", { description: Constants.per.authOnly }) async getTypeDict(@Query("addonType") addonType: string) { const list: any = this.service.getDefineList(addonType); let dict = []; @@ -138,7 +138,7 @@ export class AddonController extends CrudController { return this.ok(dict); } - @Post("/simpleInfo", { summary: Constants.per.authOnly }) + @Post("/simpleInfo", { description: Constants.per.authOnly }) async simpleInfo(@Query("addonType") addonType: string, @Query("id") id: number) { if (id === 0) { //获取默认 @@ -155,14 +155,14 @@ export class AddonController extends CrudController { return this.ok(res); } - @Post("/getDefaultId", { summary: Constants.per.authOnly }) + @Post("/getDefaultId", { description: Constants.per.authOnly }) async getDefaultId(@Query("addonType") addonType: string) { const {projectId,userId} = await this.getProjectUserIdRead(); const res = await this.service.getDefault(userId, addonType,projectId); return this.ok(res?.id); } - @Post("/setDefault", { summary: Constants.per.authOnly }) + @Post("/setDefault", { description: Constants.per.authOnly }) async setDefault(@Query("addonType") addonType: string, @Query("id") id: number) { const {projectId,userId} = await this.checkOwner(this.getService(), id, "write",true); const res = await this.service.setDefault(id, userId, addonType,projectId); @@ -170,7 +170,7 @@ export class AddonController extends CrudController { } - @Post("/options", { summary: Constants.per.authOnly }) + @Post("/options", { description: Constants.per.authOnly }) async options(@Query("addonType") addonType: string) { const {projectId,userId} = await this.getProjectUserIdRead(); const res = await this.service.list({ @@ -187,7 +187,7 @@ export class AddonController extends CrudController { } - @Post("/handle", { summary: Constants.per.authOnly }) + @Post("/handle", { description: Constants.per.authOnly }) async handle(@Body(ALL) body: AddonRequestHandleReq) { let inputAddon = body.input.addon; if (body.input.id > 0) { diff --git a/packages/ui/certd-server/src/controller/user/basic/group-controller.ts b/packages/ui/certd-server/src/controller/user/basic/group-controller.ts index b62a7caf7..e12e4c0cf 100644 --- a/packages/ui/certd-server/src/controller/user/basic/group-controller.ts +++ b/packages/ui/certd-server/src/controller/user/basic/group-controller.ts @@ -20,7 +20,7 @@ export class GroupController extends CrudController { 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 GroupController extends CrudController { 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 GroupController extends CrudController { 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.projectId = projectId; @@ -55,26 +55,26 @@ export class GroupController extends CrudController { 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(@Query('type') type: string) { const {projectId,userId} = await this.getProjectUserIdRead(); const list: any = await this.service.find({ diff --git a/packages/ui/certd-server/src/controller/user/basic/user-controller.ts b/packages/ui/certd-server/src/controller/user/basic/user-controller.ts index 9170a6539..2cec57b1f 100644 --- a/packages/ui/certd-server/src/controller/user/basic/user-controller.ts +++ b/packages/ui/certd-server/src/controller/user/basic/user-controller.ts @@ -25,7 +25,7 @@ export class BasicUserController extends BasicController { return this.service; } - @Post('/getSimpleUserByIds', { summary: Constants.per.authOnly }) + @Post('/getSimpleUserByIds', { description: Constants.per.authOnly }) async getSimpleUserByIds(@Body('ids') ids: number[]) { if(!isEnterprise()){ throw new Error('非企业模式不能获取用户信息'); @@ -45,7 +45,7 @@ export class BasicUserController extends BasicController { return this.ok(users); } - @Post('/getSimpleUsers', {summary: Constants.per.authOnly}) + @Post('/getSimpleUsers', {description: Constants.per.authOnly}) async getSimpleUsers() { if(!isEnterprise()){ throw new Error('非企业模式不能获取所有用户信息'); @@ -62,7 +62,7 @@ export class BasicUserController extends BasicController { return this.ok(users); } - @Post('/getSimpleRoles', {summary: Constants.per.authOnly}) + @Post('/getSimpleRoles', {description: Constants.per.authOnly}) async getSimpleRoles() { const roles = await this.roleService.find({ select: { diff --git a/packages/ui/certd-server/src/controller/user/cert/domain-controller.ts b/packages/ui/certd-server/src/controller/user/cert/domain-controller.ts index af482bba6..1852bf1e9 100644 --- a/packages/ui/certd-server/src/controller/user/cert/domain-controller.ts +++ b/packages/ui/certd-server/src/controller/user/cert/domain-controller.ts @@ -18,7 +18,7 @@ export class DomainController extends CrudController { 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 ?? {}; @@ -42,7 +42,7 @@ export class DomainController extends CrudController { return this.ok(pageRet); } - @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 ?? {}; @@ -52,7 +52,7 @@ export class DomainController extends CrudController { return this.ok(list); } - @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.projectId = projectId; @@ -60,7 +60,7 @@ export class DomainController extends CrudController { return super.add(bean); } - @Post('/update', { summary: Constants.per.authOnly }) + @Post('/update', { description: Constants.per.authOnly }) async update(@Body(ALL) bean: any) { await this.checkOwner(this.getService(), bean.id, "write"); delete bean.userId; @@ -68,19 +68,19 @@ export class DomainController extends CrudController { 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('/deleteByIds', { summary: Constants.per.authOnly }) + @Post('/deleteByIds', { description: Constants.per.authOnly }) async deleteByIds(@Body(ALL) body: any) { const {projectId,userId} = await this.getProjectUserIdRead(); await this.service.delete(body.ids, { @@ -91,7 +91,7 @@ export class DomainController extends CrudController { } - @Post('/import/start', { summary: Constants.per.authOnly }) + @Post('/import/start', { description: Constants.per.authOnly }) async importStart(@Body(ALL) body: any) { checkPlus(); const {projectId,userId} = await this.getProjectUserIdRead(); @@ -105,7 +105,7 @@ export class DomainController extends CrudController { return this.ok(); } - @Post('/import/status', { summary: Constants.per.authOnly }) + @Post('/import/status', { description: Constants.per.authOnly }) async importStatus() { const {projectId,userId} = await this.getProjectUserIdRead(); const req = { @@ -117,7 +117,7 @@ export class DomainController extends CrudController { } - @Post('/import/delete', { summary: Constants.per.authOnly }) + @Post('/import/delete', { description: Constants.per.authOnly }) async importDelete(@Body(ALL) body: any) { const {projectId,userId} = await this.getProjectUserIdRead(); const { key } = body; @@ -130,7 +130,7 @@ export class DomainController extends CrudController { return this.ok(); } - @Post('/import/save', { summary: Constants.per.authOnly }) + @Post('/import/save', { description: Constants.per.authOnly }) async importSave(@Body(ALL) body: any) { checkPlus(); const {projectId,userId} = await this.getProjectUserIdRead(); @@ -145,7 +145,7 @@ export class DomainController extends CrudController { } - @Post('/sync/expiration/start', { summary: Constants.per.authOnly }) + @Post('/sync/expiration/start', { description: Constants.per.authOnly }) async syncExpirationStart(@Body(ALL) body: any) { const {projectId,userId} = await this.getProjectUserIdRead(); await this.service.startSyncExpirationTask({ @@ -154,7 +154,7 @@ export class DomainController extends CrudController { }) return this.ok(); } - @Post('/sync/expiration/status', { summary: Constants.per.authOnly }) + @Post('/sync/expiration/status', { description: Constants.per.authOnly }) async syncExpirationStatus(@Body(ALL) body: any) { const {projectId,userId} = await this.getProjectUserIdRead(); const status = await this.service.getSyncExpirationTaskStatus({ diff --git a/packages/ui/certd-server/src/controller/user/cname/cname-provider-controller.ts b/packages/ui/certd-server/src/controller/user/cname/cname-provider-controller.ts index c4ce98d21..8d1b10258 100644 --- a/packages/ui/certd-server/src/controller/user/cname/cname-provider-controller.ts +++ b/packages/ui/certd-server/src/controller/user/cname/cname-provider-controller.ts @@ -20,7 +20,7 @@ export class CnameProviderController extends BaseController { return this.service; } - @Post('/list', { summary: Constants.per.authOnly }) + @Post('/list', { description: Constants.per.authOnly }) async list(@Body(ALL) body: any) { const res = await this.providerService.list({}); return this.ok(res); diff --git a/packages/ui/certd-server/src/controller/user/cname/cname-record-controller.ts b/packages/ui/certd-server/src/controller/user/cname/cname-record-controller.ts index f9516ddd0..abb0caaa2 100644 --- a/packages/ui/certd-server/src/controller/user/cname/cname-record-controller.ts +++ b/packages/ui/certd-server/src/controller/user/cname/cname-record-controller.ts @@ -17,7 +17,7 @@ export class CnameRecordController extends CrudController { return this.service; } - @Post('/page', { summary: Constants.per.authOnly }) + @Post('/page', { description: Constants.per.authOnly }) async page(@Body(ALL) body: any) { const {userId,projectId} = await this.getProjectUserIdRead(); body.query = body.query ?? {}; @@ -41,7 +41,7 @@ export class CnameRecordController extends CrudController { return this.ok(pageRet); } - @Post('/list', { summary: Constants.per.authOnly }) + @Post('/list', { description: Constants.per.authOnly }) async list(@Body(ALL) body: any) { const {userId,projectId} = await this.getProjectUserIdRead(); body.query = body.query ?? {}; @@ -51,7 +51,7 @@ export class CnameRecordController extends CrudController { return this.ok(list); } - @Post('/add', { summary: Constants.per.authOnly }) + @Post('/add', { description: Constants.per.authOnly }) async add(@Body(ALL) bean: any) { const {userId,projectId} = await this.getProjectUserIdWrite(); bean.userId = userId; @@ -59,7 +59,7 @@ export class CnameRecordController extends CrudController { return super.add(bean); } - @Post('/update', { summary: Constants.per.authOnly }) + @Post('/update', { description: Constants.per.authOnly }) async update(@Body(ALL) bean: any) { await this.checkOwner(this.getService(), bean.id, "write"); delete bean.userId; @@ -67,19 +67,19 @@ export class CnameRecordController extends CrudController { 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('/deleteByIds', { summary: Constants.per.authOnly }) + @Post('/deleteByIds', { description: Constants.per.authOnly }) async deleteByIds(@Body(ALL) body: any) { const {userId,projectId} = await this.getProjectUserIdWrite(); await this.service.delete(body.ids, { @@ -88,27 +88,27 @@ export class CnameRecordController extends CrudController { }); return this.ok(); } - @Post('/getByDomain', { summary: Constants.per.authOnly }) + @Post('/getByDomain', { description: Constants.per.authOnly }) async getByDomain(@Body(ALL) body: { domain: string; createOnNotFound: boolean }) { const {userId,projectId} = await this.getProjectUserIdRead(); const res = await this.service.getByDomain(body.domain, userId,projectId, body.createOnNotFound); return this.ok(res); } - @Post('/verify', { summary: Constants.per.authOnly }) + @Post('/verify', { description: Constants.per.authOnly }) async verify(@Body(ALL) body: { id: number }) { await this.checkOwner(this.getService(), body.id, "read"); const res = await this.service.verify(body.id); return this.ok(res); } - @Post('/resetStatus', { summary: Constants.per.authOnly }) + @Post('/resetStatus', { description: Constants.per.authOnly }) async resetStatus(@Body(ALL) body: { id: number }) { await this.checkOwner(this.getService(), body.id, "read"); const res = await this.service.resetStatus(body.id); return this.ok(res); } - @Post('/import', { summary: Constants.per.authOnly }) + @Post('/import', { description: Constants.per.authOnly }) async import(@Body(ALL) body: { domainList: string; cnameProviderId: any }) { const {userId,projectId} = await this.getProjectUserIdWrite(); const res = await this.service.doImport({ diff --git a/packages/ui/certd-server/src/controller/user/dashboard/statistic-controller.ts b/packages/ui/certd-server/src/controller/user/dashboard/statistic-controller.ts index fdd18f7cb..81758890b 100644 --- a/packages/ui/certd-server/src/controller/user/dashboard/statistic-controller.ts +++ b/packages/ui/certd-server/src/controller/user/dashboard/statistic-controller.ts @@ -46,7 +46,7 @@ export class StatisticController extends BaseController { @Inject() certInfoService: CertInfoService; - @Post('/count', { summary: Constants.per.authOnly }) + @Post('/count', { description: Constants.per.authOnly }) public async count() { const {userId,projectId} = await this.getProjectUserIdRead(); const pipelineCount = await this.pipelineService.count({ userId,projectId }); diff --git a/packages/ui/certd-server/src/controller/user/enterprise/project-controller.ts b/packages/ui/certd-server/src/controller/user/enterprise/project-controller.ts index 8a25cf619..1f5dee835 100644 --- a/packages/ui/certd-server/src/controller/user/enterprise/project-controller.ts +++ b/packages/ui/certd-server/src/controller/user/enterprise/project-controller.ts @@ -28,7 +28,7 @@ export class UserProjectController extends BaseController { * @param body * @returns */ - @Post('/detail', { summary: Constants.per.authOnly }) + @Post('/detail', { description: Constants.per.authOnly }) async detail(@Body(ALL) body: any) { const {projectId} = await this.getProjectUserIdRead(); const res = await this.service.getDetail(projectId,this.getUserId()); @@ -41,7 +41,7 @@ export class UserProjectController extends BaseController { * @param body * @returns */ - @Post('/list', { summary: Constants.per.authOnly }) + @Post('/list', { description: Constants.per.authOnly }) async list(@Body(ALL) body: any) { const userId= this.getUserId(); const res = await this.service.getUserProjects(userId); @@ -54,21 +54,21 @@ export class UserProjectController extends BaseController { * @param body 所有项目 * @returns */ - @Post('/all', { summary: Constants.per.authOnly }) + @Post('/all', { description: Constants.per.authOnly }) async all(@Body(ALL) body: any) { const userId= this.getUserId(); const res = await this.service.getAllWithStatus(userId); return this.ok(res); } - @Post('/applyJoin', { summary: Constants.per.authOnly }) + @Post('/applyJoin', { description: Constants.per.authOnly }) async applyJoin(@Body(ALL) body: any) { const userId= this.getUserId(); const res = await this.service.applyJoin({ userId, projectId: body.projectId }); return this.ok(res); } - @Post('/updateMember', { summary: Constants.per.authOnly }) + @Post('/updateMember', { description: Constants.per.authOnly }) async updateMember(@Body(ALL) body: any) { const {projectId} = await this.getProjectUserIdAdmin(); const {status,permission,userId} = body; @@ -89,7 +89,7 @@ export class UserProjectController extends BaseController { return this.ok(res); } - @Post('/approveJoin', { summary: Constants.per.authOnly }) + @Post('/approveJoin', { description: Constants.per.authOnly }) async approveJoin(@Body(ALL) body: any) { const {projectId} = await this.getProjectUserIdAdmin(); const {status,permission,userId} = body; @@ -97,7 +97,7 @@ export class UserProjectController extends BaseController { return this.ok(res); } - @Post('/delete', { summary: Constants.per.authOnly }) + @Post('/delete', { description: Constants.per.authOnly }) async delete(@Body(ALL) body: any) { const {projectId} = await this.getProjectUserIdAdmin(); await this.projectMemberService.deleteWhere({ @@ -107,7 +107,7 @@ export class UserProjectController extends BaseController { return this.ok(); } - @Post('/leave', { summary: Constants.per.authOnly }) + @Post('/leave', { description: Constants.per.authOnly }) async leave(@Body(ALL) body: any) { const {projectId} = body const userId = this.getUserId(); diff --git a/packages/ui/certd-server/src/controller/user/enterprise/project-member-controller.ts b/packages/ui/certd-server/src/controller/user/enterprise/project-member-controller.ts index 6f3b809b2..cbaff9bbb 100644 --- a/packages/ui/certd-server/src/controller/user/enterprise/project-member-controller.ts +++ b/packages/ui/certd-server/src/controller/user/enterprise/project-member-controller.ts @@ -24,7 +24,7 @@ export class ProjectMemberController extends CrudController return this.service; } - @Post("/page", { summary: Constants.per.authOnly }) + @Post("/page", { description: Constants.per.authOnly }) async page(@Body(ALL) body: any) { const {projectId} = await this.getProjectUserIdRead(); body.query = body.query ?? {}; @@ -32,7 +32,7 @@ export class ProjectMemberController extends CrudController return await super.page(body); } - @Post("/list", { summary: Constants.per.authOnly }) + @Post("/list", { description: Constants.per.authOnly }) async list(@Body(ALL) body: any) { const {projectId} = await this.getProjectUserIdRead(); body.query = body.query ?? {}; @@ -40,7 +40,7 @@ export class ProjectMemberController extends CrudController return super.list(body); } - @Post("/add", { summary: Constants.per.authOnly }) + @Post("/add", { description: Constants.per.authOnly }) async add(@Body(ALL) bean: any) { const def: any = { isDefault: false, @@ -56,7 +56,7 @@ export class ProjectMemberController extends CrudController return super.add(bean); } - @Post("/update", { summary: Constants.per.authOnly }) + @Post("/update", { description: Constants.per.authOnly }) async update(@Body(ALL) bean: any) { if (!bean.id) { throw new Error("id is required"); @@ -75,7 +75,7 @@ export class ProjectMemberController extends CrudController return this.ok(res); } - @Post("/info", { summary: Constants.per.authOnly }) + @Post("/info", { description: Constants.per.authOnly }) async info(@Query("id") id: number) { if (!id) { throw new Error("id is required"); @@ -88,7 +88,7 @@ export class ProjectMemberController extends CrudController return super.info(id); } - @Post("/delete", { summary: Constants.per.authOnly }) + @Post("/delete", { description: Constants.per.authOnly }) async delete(@Query("id") id: number) { if (!id) { throw new Error("id is required"); @@ -101,7 +101,7 @@ export class ProjectMemberController extends CrudController return super.delete(id); } - @Post("/deleteByIds", { summary: Constants.per.authOnly }) + @Post("/deleteByIds", { description: Constants.per.authOnly }) async deleteByIds(@Body("ids") ids: number[]) { for (const id of ids) { if (!id) { diff --git a/packages/ui/certd-server/src/controller/user/enterprise/transfer-controller.ts b/packages/ui/certd-server/src/controller/user/enterprise/transfer-controller.ts index 9bf5fbb42..95d395340 100644 --- a/packages/ui/certd-server/src/controller/user/enterprise/transfer-controller.ts +++ b/packages/ui/certd-server/src/controller/user/enterprise/transfer-controller.ts @@ -22,7 +22,7 @@ export class TransferController extends BaseController { * @param body * @returns */ - @Post('/selfResources', { summary: Constants.per.authOnly }) + @Post('/selfResources', { description: Constants.per.authOnly }) async selfResources() { const userId = this.getUserId(); const res = await this.service.getUserResources(userId); @@ -34,7 +34,7 @@ export class TransferController extends BaseController { * @param body * @returns */ - @Post('/doTransfer', { summary: Constants.per.authOnly }) + @Post('/doTransfer', { description: Constants.per.authOnly }) async doTransfer() { const {projectId} = await this.getProjectUserIdRead(); const userId = this.getUserId(); diff --git a/packages/ui/certd-server/src/controller/user/mine/email-controller.ts b/packages/ui/certd-server/src/controller/user/mine/email-controller.ts index 2f41c8387..006d626d8 100644 --- a/packages/ui/certd-server/src/controller/user/mine/email-controller.ts +++ b/packages/ui/certd-server/src/controller/user/mine/email-controller.ts @@ -13,28 +13,28 @@ export class EmailController extends BaseController { @Inject() emailService: EmailService; - @Post('/test', { summary: Constants.per.authOnly }) + @Post('/test', { description: Constants.per.authOnly }) public async test(@Body('receiver') receiver) { const userId = super.getUserId(); await this.emailService.test(userId, receiver); return this.ok({}); } - @Post('/list', { summary: Constants.per.authOnly }) + @Post('/list', { description: Constants.per.authOnly }) public async list() { const userId = super.getUserId(); const res = await this.emailService.list(userId); return this.ok(res); } - @Post('/add', { summary: Constants.per.authOnly }) + @Post('/add', { description: Constants.per.authOnly }) public async add(@Body('email') email) { const userId = super.getUserId(); await this.emailService.add(userId, email); return this.ok({}); } - @Post('/delete', { summary: Constants.per.authOnly }) + @Post('/delete', { description: Constants.per.authOnly }) public async delete(@Body('email') email) { const userId = super.getUserId(); await this.emailService.delete(userId, email); diff --git a/packages/ui/certd-server/src/controller/user/mine/mine-controller.ts b/packages/ui/certd-server/src/controller/user/mine/mine-controller.ts index e07ad96f7..c9133571a 100644 --- a/packages/ui/certd-server/src/controller/user/mine/mine-controller.ts +++ b/packages/ui/certd-server/src/controller/user/mine/mine-controller.ts @@ -21,7 +21,7 @@ export class MineController extends BaseController { passkeyService: PasskeyService; - @Post('/info', { summary: Constants.per.authOnly }) + @Post('/info', { description: Constants.per.authOnly }) public async info() { const userId = this.getUserId(); const user = await this.userService.info(userId); @@ -35,14 +35,14 @@ export class MineController extends BaseController { return this.ok(user); } - @Post('/changePassword', { summary: Constants.per.authOnly }) + @Post('/changePassword', { description: Constants.per.authOnly }) public async changePassword(@Body(ALL) body: any) { const userId = this.getUserId(); await this.userService.changePassword(userId, body); return this.ok({}); } - @Post('/updateProfile', { summary: Constants.per.authOnly }) + @Post('/updateProfile', { description: Constants.per.authOnly }) public async updateProfile(@Body(ALL) body: any) { const userId = this.getUserId(); diff --git a/packages/ui/certd-server/src/controller/user/mine/passkey-controller.ts b/packages/ui/certd-server/src/controller/user/mine/passkey-controller.ts index 4fd8b8c71..22a722dc2 100644 --- a/packages/ui/certd-server/src/controller/user/mine/passkey-controller.ts +++ b/packages/ui/certd-server/src/controller/user/mine/passkey-controller.ts @@ -14,7 +14,7 @@ export class MinePasskeyController extends BaseController { @Inject() userService: UserService; - @Post('/generateRegistration', { summary: Constants.per.authOnly }) + @Post('/generateRegistration', { description: Constants.per.authOnly }) public async generateRegistration( @Body(ALL) body: any, @@ -41,7 +41,7 @@ export class MinePasskeyController extends BaseController { }); } - @Post('/verifyRegistration', { summary: Constants.per.authOnly }) + @Post('/verifyRegistration', { description: Constants.per.authOnly }) public async verifyRegistration( @Body(ALL) body: any @@ -64,7 +64,7 @@ export class MinePasskeyController extends BaseController { - @Post('/register', { summary: Constants.per.authOnly }) + @Post('/register', { description: Constants.per.authOnly }) public async registerPasskey( @Body(ALL) body: any @@ -86,7 +86,7 @@ export class MinePasskeyController extends BaseController { } - @Post('/list', { summary: Constants.per.authOnly }) + @Post('/list', { description: Constants.per.authOnly }) public async getPasskeys() { const userId = this.getUserId(); const passkeys = await this.passkeyService.find({ @@ -97,7 +97,7 @@ export class MinePasskeyController extends BaseController { return this.ok(passkeys); } - @Post('/unbind', { summary: Constants.per.authOnly }) + @Post('/unbind', { description: Constants.per.authOnly }) public async unbindPasskey(@Body(ALL) body: any) { const userId = this.getUserId(); const passkeyId = body.id; diff --git a/packages/ui/certd-server/src/controller/user/mine/setting-two-factor-controller.ts b/packages/ui/certd-server/src/controller/user/mine/setting-two-factor-controller.ts index 1d5e6fd05..d7ac590da 100644 --- a/packages/ui/certd-server/src/controller/user/mine/setting-two-factor-controller.ts +++ b/packages/ui/certd-server/src/controller/user/mine/setting-two-factor-controller.ts @@ -21,14 +21,14 @@ export class UserTwoFactorSettingController extends BaseController { - @Post("/get", { summary: Constants.per.authOnly }) + @Post("/get", { description: Constants.per.authOnly }) async get() { const userId = this.getUserId(); const setting = await this.service.getSetting(userId,null, UserTwoFactorSetting); return this.ok(setting); } - @Post("/save", { summary: Constants.per.authOnly }) + @Post("/save", { description: Constants.per.authOnly }) async save(@Body(ALL) bean: any) { if (!isPlus()) { throw new Error('本功能需要开通专业版') @@ -47,14 +47,14 @@ export class UserTwoFactorSettingController extends BaseController { return this.ok({}); } - @Post("/authenticator/qrcode", { summary: Constants.per.authOnly }) + @Post("/authenticator/qrcode", { description: Constants.per.authOnly }) async authenticatorQrcode() { const userId = this.getUserId(); const {qrcode,link,secret} = await this.twoFactorService.getAuthenticatorQrCode(userId); return this.ok({qrcode,link,secret}); } - @Post("/authenticator/save", { summary: Constants.per.authOnly }) + @Post("/authenticator/save", { description: Constants.per.authOnly }) async authenticatorSave(@Body(ALL) bean: any) { if (!isPlus()) { throw new Error('本功能需要开通专业版') @@ -67,7 +67,7 @@ export class UserTwoFactorSettingController extends BaseController { return this.ok(); } - @Post("/authenticator/off", { summary: Constants.per.authOnly }) + @Post("/authenticator/off", { description: Constants.per.authOnly }) async authenticatorOff() { const userId = this.getUserId(); await this.twoFactorService.offAuthenticator(userId); diff --git a/packages/ui/certd-server/src/controller/user/mine/user-settings-controller.ts b/packages/ui/certd-server/src/controller/user/mine/user-settings-controller.ts index 4d135dd06..0499a1946 100644 --- a/packages/ui/certd-server/src/controller/user/mine/user-settings-controller.ts +++ b/packages/ui/certd-server/src/controller/user/mine/user-settings-controller.ts @@ -20,65 +20,65 @@ export class UserSettingsController extends CrudController return this.service; } - @Post('/page', { summary: Constants.per.authOnly }) + @Post('/page', { description: Constants.per.authOnly }) async page(@Body(ALL) body) { body.query = body.query ?? {}; body.query.userId = this.getUserId(); return super.page(body); } - @Post('/list', { summary: Constants.per.authOnly }) + @Post('/list', { description: Constants.per.authOnly }) async list(@Body(ALL) body) { body.query = body.query ?? {}; body.query.userId = this.getUserId(); return super.list(body); } - @Post('/add', { summary: Constants.per.authOnly }) + @Post('/add', { description: Constants.per.authOnly }) async add(@Body(ALL) bean) { bean.userId = this.getUserId(); return super.add(bean); } - @Post('/update', { summary: Constants.per.authOnly }) + @Post('/update', { description: Constants.per.authOnly }) async update(@Body(ALL) bean) { await this.service.checkUserId(bean.id, this.getUserId()); delete bean.userId; return super.update(bean); } - @Post('/info', { summary: Constants.per.authOnly }) + @Post('/info', { description: Constants.per.authOnly }) async info(@Query('id') id: number) { await this.service.checkUserId(id, this.getUserId()); return super.info(id); } - @Post('/delete', { summary: Constants.per.authOnly }) + @Post('/delete', { description: Constants.per.authOnly }) async delete(@Query('id') id: number) { await this.service.checkUserId(id, this.getUserId()); return super.delete(id); } - @Post('/save', { summary: Constants.per.authOnly }) + @Post('/save', { description: Constants.per.authOnly }) async save(@Body(ALL) bean: UserSettingsEntity) { bean.userId = this.getUserId(); await this.service.save(bean); return this.ok({}); } - @Post('/get', { summary: Constants.per.authOnly }) + @Post('/get', { description: Constants.per.authOnly }) async get(@Query('key') key: string) { const {projectId,userId} = await this.getProjectUserIdRead(); const entity = await this.service.getByKey(key, userId, projectId); return this.ok(entity); } - @Post("/grant/get", { summary: Constants.per.authOnly }) + @Post("/grant/get", { description: Constants.per.authOnly }) async grantSettingsGet() { const userId = this.getUserId(); const setting = await this.service.getSetting(userId, null, UserGrantSetting); return this.ok(setting); } - @Post("/grant/save", { summary: Constants.per.authOnly }) + @Post("/grant/save", { description: Constants.per.authOnly }) async grantSettingsSave(@Body(ALL) bean: UserGrantSetting) { if (!isPlus()) { throw new Error('本功能需要开通专业版') diff --git a/packages/ui/certd-server/src/controller/user/monitor/cert-info-controller.ts b/packages/ui/certd-server/src/controller/user/monitor/cert-info-controller.ts index b4403e42b..abd6c5613 100644 --- a/packages/ui/certd-server/src/controller/user/monitor/cert-info-controller.ts +++ b/packages/ui/certd-server/src/controller/user/monitor/cert-info-controller.ts @@ -29,7 +29,7 @@ export class CertInfoController extends CrudController { return this.service; } - @Post('/page', { summary: Constants.per.authOnly }) + @Post('/page', { description: Constants.per.authOnly }) async page(@Body(ALL) body: any) { body.query = body.query ?? {}; @@ -78,7 +78,7 @@ export class CertInfoController extends CrudController { return this.ok(res); } - @Post('/list', { summary: Constants.per.authOnly }) + @Post('/list', { description: Constants.per.authOnly }) async list(@Body(ALL) body: any) { body.query = body.query ?? {}; const { projectId, userId } = await this.getProjectUserIdRead() @@ -88,7 +88,7 @@ export class CertInfoController extends CrudController { } - @Post('/getOptionsByIds', { summary: Constants.per.authOnly }) + @Post('/getOptionsByIds', { description: Constants.per.authOnly }) async getOptionsByIds(@Body(ALL) body: {ids:any[]}) { const { projectId, userId } = await this.getProjectUserIdRead() const list = await this.service.list({ @@ -113,7 +113,7 @@ export class CertInfoController extends CrudController { return this.ok(safeList); } - @Post('/add', { summary: Constants.per.authOnly }) + @Post('/add', { description: Constants.per.authOnly }) async add(@Body(ALL) bean: any) { const { projectId, userId } = await this.getProjectUserIdWrite() bean.projectId = projectId @@ -121,26 +121,26 @@ export class CertInfoController extends CrudController { 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.service,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.service,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.service,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({ @@ -154,7 +154,7 @@ export class CertInfoController extends CrudController { - @Post('/getCert', { summary: Constants.per.authOnly }) + @Post('/getCert', { description: Constants.per.authOnly }) async getCert(@Query('id') id: number) { await this.checkOwner(this.getService(),id,"read"); const certInfoEntity = await this.service.info(id); @@ -162,7 +162,7 @@ export class CertInfoController extends CrudController { return this.ok(certInfo); } - @Get('/download', { summary: Constants.per.authOnly }) + @Get('/download', { description: Constants.per.authOnly }) async download(@Query('id') id: number) { const {userId,projectId} =await this.checkOwner(this.getService(),id,"read"); const certInfo = await this.getService().info(id) diff --git a/packages/ui/certd-server/src/controller/user/monitor/site-info-controller.ts b/packages/ui/certd-server/src/controller/user/monitor/site-info-controller.ts index 3591654aa..d206f5207 100644 --- a/packages/ui/certd-server/src/controller/user/monitor/site-info-controller.ts +++ b/packages/ui/certd-server/src/controller/user/monitor/site-info-controller.ts @@ -25,7 +25,7 @@ export class SiteInfoController extends CrudController { return this.service; } - @Post('/page', { summary: Constants.per.authOnly }) + @Post('/page', { description: Constants.per.authOnly }) async page(@Body(ALL) body: any) { body.query = body.query ?? {}; const { projectId, userId } = await this.getProjectUserIdRead() @@ -56,7 +56,7 @@ export class SiteInfoController extends CrudController { return this.ok(res); } - @Post('/list', { summary: Constants.per.authOnly }) + @Post('/list', { description: Constants.per.authOnly }) async list(@Body(ALL) body: any) { body.query = body.query ?? {}; const { projectId, userId } = await this.getProjectUserIdRead() @@ -65,7 +65,7 @@ export class SiteInfoController extends CrudController { 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.getProjectUserIdWrite() bean.projectId = projectId @@ -78,7 +78,7 @@ export class SiteInfoController extends CrudController { return this.ok(res); } - @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; @@ -90,27 +90,27 @@ export class SiteInfoController extends CrudController { } return this.ok(); } - @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 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.service,id,"write"); return await super.delete(id); } - @Post('/batchDelete', { summary: Constants.per.authOnly }) + @Post('/batchDelete', { description: Constants.per.authOnly }) async batchDelete(@Body(ALL) body: any) { const { projectId, userId } = await this.getProjectUserIdWrite() await this.service.batchDelete(body.ids,userId,projectId); return this.ok(); } - @Post('/check', { summary: Constants.per.authOnly }) + @Post('/check', { description: Constants.per.authOnly }) async check(@Body('id') id: number) { await this.checkOwner(this.service,id,"read"); await this.service.check(id, true, 0); @@ -118,14 +118,14 @@ export class SiteInfoController extends CrudController { return this.ok(); } - @Post('/checkAll', { summary: Constants.per.authOnly }) + @Post('/checkAll', { description: Constants.per.authOnly }) async checkAll() { const { projectId, userId } = await this.getProjectUserIdWrite() await this.service.checkAllByUsers(userId,projectId); return this.ok(); } - @Post('/import', { summary: Constants.per.authOnly }) + @Post('/import', { description: Constants.per.authOnly }) async doImport(@Body(ALL) body: any) { const { projectId, userId } = await this.getProjectUserIdWrite() await this.service.doImport({ @@ -138,7 +138,7 @@ export class SiteInfoController extends CrudController { } - @Post('/ipCheckChange', { summary: Constants.per.authOnly }) + @Post('/ipCheckChange', { description: Constants.per.authOnly }) async ipCheckChange(@Body(ALL) bean: any) { await this.checkOwner(this.service,bean.id,"read"); await this.service.ipCheckChange({ @@ -148,7 +148,7 @@ export class SiteInfoController extends CrudController { return this.ok(); } - @Post('/disabledChange', { summary: Constants.per.authOnly }) + @Post('/disabledChange', { description: Constants.per.authOnly }) async disabledChange(@Body(ALL) bean: any) { await this.checkOwner(this.service,bean.id,"write"); await this.service.disabledChange({ @@ -158,14 +158,14 @@ export class SiteInfoController extends CrudController { return this.ok(); } - @Post("/setting/get", { summary: Constants.per.authOnly }) + @Post("/setting/get", { description: Constants.per.authOnly }) async get() { const { userId, projectId } = await this.getProjectUserIdRead() const setting = await this.service.getSetting(userId, projectId) return this.ok(setting); } - @Post("/setting/save", { summary: Constants.per.authOnly }) + @Post("/setting/save", { description: Constants.per.authOnly }) async save(@Body(ALL) bean: any) { const { userId, projectId} = await this.getProjectUserIdWrite() const setting = new UserSiteMonitorSetting(); diff --git a/packages/ui/certd-server/src/controller/user/monitor/site-ip-controller.ts b/packages/ui/certd-server/src/controller/user/monitor/site-ip-controller.ts index 28e0adf58..4a354d3cb 100644 --- a/packages/ui/certd-server/src/controller/user/monitor/site-ip-controller.ts +++ b/packages/ui/certd-server/src/controller/user/monitor/site-ip-controller.ts @@ -22,7 +22,7 @@ export class SiteInfoController extends CrudController { 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 ?? {}; @@ -36,7 +36,7 @@ export class SiteInfoController extends CrudController { return this.ok(res); } - @Post('/list', { summary: Constants.per.authOnly }) + @Post('/list', { description: Constants.per.authOnly }) async list(@Body(ALL) body: any) { body.query = body.query ?? {}; const { projectId, userId } = await this.getProjectUserIdRead() @@ -45,7 +45,7 @@ export class SiteInfoController extends CrudController { 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.getProjectUserIdWrite() bean.userId = userId; @@ -60,7 +60,7 @@ export class SiteInfoController extends CrudController { return this.ok(res); } - @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; @@ -73,13 +73,13 @@ export class SiteInfoController extends CrudController { } return this.ok(); } - @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 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.service,id,"write"); const entity = await this.service.info(id); @@ -90,7 +90,7 @@ export class SiteInfoController extends CrudController { - @Post('/check', { summary: Constants.per.authOnly }) + @Post('/check', { description: Constants.per.authOnly }) async check(@Body('id') id: number) { await this.checkOwner(this.service,id,"read"); const entity = await this.service.info(id); @@ -101,7 +101,7 @@ export class SiteInfoController extends CrudController { return this.ok(); } - @Post('/checkAll', { summary: Constants.per.authOnly }) + @Post('/checkAll', { description: Constants.per.authOnly }) async checkAll(@Body('siteId') siteId: number) { await this.getProjectUserIdRead() const siteEntity = await this.siteInfoService.info(siteId); @@ -109,7 +109,7 @@ export class SiteInfoController extends CrudController { return this.ok(); } - @Post('/sync', { summary: Constants.per.authOnly }) + @Post('/sync', { description: Constants.per.authOnly }) async sync(@Body('siteId') siteId: number) { await this.getProjectUserIdWrite() const entity = await this.siteInfoService.info(siteId) @@ -117,7 +117,7 @@ export class SiteInfoController extends CrudController { return this.ok(); } - @Post('/import', { summary: Constants.per.authOnly }) + @Post('/import', { description: Constants.per.authOnly }) async doImport(@Body(ALL) body: any) { const { userId, projectId } = await this.getProjectUserIdWrite() await this.service.doImport({ diff --git a/packages/ui/certd-server/src/controller/user/open/open-key-controller.ts b/packages/ui/certd-server/src/controller/user/open/open-key-controller.ts index 22b7d92d5..36f363db0 100644 --- a/packages/ui/certd-server/src/controller/user/open/open-key-controller.ts +++ b/packages/ui/certd-server/src/controller/user/open/open-key-controller.ts @@ -19,7 +19,7 @@ export class OpenKeyController extends CrudController { 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 ?? {}; @@ -33,7 +33,7 @@ export class OpenKeyController extends CrudController { 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 ?? {}; @@ -42,7 +42,7 @@ export class OpenKeyController extends CrudController { return await super.list(body); } - @Post('/add', { summary: Constants.per.authOnly }) + @Post('/add', { description: Constants.per.authOnly }) async add(@Body(ALL) body: any) { const {projectId,userId} = await this.getProjectUserIdRead(); body.projectId = projectId; @@ -51,7 +51,7 @@ export class OpenKeyController extends CrudController { return this.ok(res); } - @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; @@ -59,19 +59,19 @@ export class OpenKeyController extends CrudController { await this.service.update(bean); return this.ok(); } - @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('/getApiToken', { summary: Constants.per.authOnly }) + @Post('/getApiToken', { description: Constants.per.authOnly }) async getApiToken(@Body('id') id: number) { await this.checkOwner(this.getService(), id, "write"); const token = await this.service.getApiToken(id); diff --git a/packages/ui/certd-server/src/controller/user/pipeline/access-controller.ts b/packages/ui/certd-server/src/controller/user/pipeline/access-controller.ts index e942ed572..e323976ea 100644 --- a/packages/ui/certd-server/src/controller/user/pipeline/access-controller.ts +++ b/packages/ui/certd-server/src/controller/user/pipeline/access-controller.ts @@ -21,7 +21,7 @@ export class AccessController extends CrudController { 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 { 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 { 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 { 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 { 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 { 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); diff --git a/packages/ui/certd-server/src/controller/user/pipeline/cert-controller.ts b/packages/ui/certd-server/src/controller/user/pipeline/cert-controller.ts index 262170487..cbb900e59 100644 --- a/packages/ui/certd-server/src/controller/user/pipeline/cert-controller.ts +++ b/packages/ui/certd-server/src/controller/user/pipeline/cert-controller.ts @@ -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'); diff --git a/packages/ui/certd-server/src/controller/user/pipeline/dns-provider-controller.ts b/packages/ui/certd-server/src/controller/user/pipeline/dns-provider-controller.ts index e1c8479c4..7019b3237 100644 --- a/packages/ui/certd-server/src/controller/user/pipeline/dns-provider-controller.ts +++ b/packages/ui/certd-server/src/controller/user/pipeline/dns-provider-controller.ts @@ -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 = []; diff --git a/packages/ui/certd-server/src/controller/user/pipeline/handle-controller.ts b/packages/ui/certd-server/src/controller/user/pipeline/handle-controller.ts index 82ff87cc0..67822fde6 100644 --- a/packages/ui/certd-server/src/controller/user/pipeline/handle-controller.ts +++ b/packages/ui/certd-server/src/controller/user/pipeline/handle-controller.ts @@ -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); diff --git a/packages/ui/certd-server/src/controller/user/pipeline/history-controller.ts b/packages/ui/certd-server/src/controller/user/pipeline/history-controller.ts index f63035caa..f8f9ad199 100644 --- a/packages/ui/certd-server/src/controller/user/pipeline/history-controller.ts +++ b/packages/ui/certd-server/src/controller/user/pipeline/history-controller.ts @@ -41,7 +41,7 @@ export class HistoryController extends CrudController { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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); diff --git a/packages/ui/certd-server/src/controller/user/pipeline/notification-controller.ts b/packages/ui/certd-server/src/controller/user/pipeline/notification-controller.ts index b5dc9f9e6..704820fbd 100644 --- a/packages/ui/certd-server/src/controller/user/pipeline/notification-controller.ts +++ b/packages/ui/certd-server/src/controller/user/pipeline/notification-controller.ts @@ -22,7 +22,7 @@ export class NotificationController extends CrudController 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 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 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 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 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 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 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 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({ diff --git a/packages/ui/certd-server/src/controller/user/pipeline/pipeline-controller.ts b/packages/ui/certd-server/src/controller/user/pipeline/pipeline-controller.ts index 135e32881..c8b1dd963 100644 --- a/packages/ui/certd-server/src/controller/user/pipeline/pipeline-controller.ts +++ b/packages/ui/certd-server/src/controller/user/pipeline/pipeline-controller.ts @@ -32,7 +32,7 @@ export class PipelineController extends CrudController { 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 { 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 { } - // @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 { // 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 { // 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 { 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 { 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 { 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 { - @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 { } - @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 { 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 { 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 { 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 { 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); diff --git a/packages/ui/certd-server/src/controller/user/pipeline/pipeline-group-controller.ts b/packages/ui/certd-server/src/controller/user/pipeline/pipeline-group-controller.ts index f37d3d4d1..6108441d9 100644 --- a/packages/ui/certd-server/src/controller/user/pipeline/pipeline-group-controller.ts +++ b/packages/ui/certd-server/src/controller/user/pipeline/pipeline-group-controller.ts @@ -20,7 +20,7 @@ export class PipelineGroupController extends CrudController { 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 { } - @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 { 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 { 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 { 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); diff --git a/packages/ui/certd-server/src/controller/user/pipeline/template-controller.ts b/packages/ui/certd-server/src/controller/user/pipeline/template-controller.ts index e70f69641..6e54979ff 100644 --- a/packages/ui/certd-server/src/controller/user/pipeline/template-controller.ts +++ b/packages/ui/certd-server/src/controller/user/pipeline/template-controller.ts @@ -19,7 +19,7 @@ export class TemplateController extends CrudController { } - @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 { 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 { 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 { 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; diff --git a/packages/ui/certd-server/src/middleware/authority.ts b/packages/ui/certd-server/src/middleware/authority.ts index 205ec1c31..181f90fc4 100644 --- a/packages/ui/certd-server/src/middleware/authority.ts +++ b/packages/ui/certd-server/src/middleware/authority.ts @@ -40,13 +40,13 @@ export class AuthorityMiddleware implements IWebMiddleware { await next(); return; } - const permission = routeInfo.summary; + let permission = routeInfo.description || ''; + permission = permission.trim().split(' ')[0]; if (permission == null || permission === '') { ctx.status = 500; ctx.body = Constants.res.serverError('该路由未配置权限控制:' + ctx.path); return; } - if (permission === Constants.per.guest) { await next(); return;