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

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