chore: swagger support

This commit is contained in:
xiaojunnuo
2026-03-15 14:01:34 +08:00
parent 8a3841f638
commit 684964da4f
40 changed files with 110 additions and 22 deletions
@@ -116,7 +116,7 @@ export abstract class BaseController {
await authService.checkProjectId(service, id, projectId);
}else{
if(userId === 0){
if(userId === Constants.systemUserId){
//系统级别,不检查权限
}else{
if(allowAdmin){
@@ -4,6 +4,7 @@ import { Inject } from '@midwayjs/core';
import { TypeORMDataSourceManager } from '@midwayjs/typeorm';
import { EntityManager } from 'typeorm/entity-manager/EntityManager.js';
import { FindManyOptions } from 'typeorm';
import { Constants } from './constants.js';
export type PageReq<T = any> = {
page?: { offset: number; limit: number };
@@ -258,7 +259,7 @@ export abstract class BaseService<T> {
export function checkUserProjectParam(userId: number, projectId: number) {
if (projectId != null ){
if( userId !==-1) {
if( userId !== Constants.enterpriseUserId) {
throw new ValidateException('userId projectId 错误');
}
return true
@@ -120,4 +120,6 @@ export const Constants = {
message: '用户邮箱还未配置',
},
},
systemUserId: 0, // 系统级别userid固定为0
enterpriseUserId: -1 // 企业模式用户id固定为-1
};