refactor(api): 移除菜单的 component 和 permission 字段
- Schema 移除 Menu.component 和 Menu.permission 字段 - isStatic 默认值改为 false - MenuTreeNode 增加 isExternal、isStatic、isEnabled、sort 字段 - DTO 同步更新 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -72,12 +72,10 @@ model Menu {
|
||||
type String @default("menu") // dir / menu / button
|
||||
path String?
|
||||
icon String? // Lucide 图标名
|
||||
component String?
|
||||
permission String? // 关联权限编码
|
||||
isExternal Boolean @default(false)
|
||||
isHidden Boolean @default(false)
|
||||
isEnabled Boolean @default(true)
|
||||
isStatic Boolean @default(true) // 静态/动态菜单
|
||||
isStatic Boolean @default(false) // 静态/动态菜单
|
||||
sort Int @default(0)
|
||||
meta Json?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@ -33,16 +33,6 @@ export class CreateMenuDto implements ICreateMenuDto {
|
||||
@IsOptional()
|
||||
icon?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'users/index', description: '组件路径' })
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
component?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'user:read', description: '关联权限编码' })
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
permission?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: false, description: '是否外链' })
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
@@ -102,16 +92,6 @@ export class UpdateMenuDto implements IUpdateMenuDto {
|
||||
@IsOptional()
|
||||
icon?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'users/index', description: '组件路径' })
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
component?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'user:read', description: '关联权限编码' })
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
permission?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: false, description: '是否外链' })
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
@@ -162,12 +142,6 @@ export class MenuResponseDto implements MenuResponse {
|
||||
@ApiProperty({ example: 'Users', description: 'Lucide 图标名', nullable: true })
|
||||
icon: string | null;
|
||||
|
||||
@ApiProperty({ example: 'users/index', description: '组件路径', nullable: true })
|
||||
component: string | null;
|
||||
|
||||
@ApiProperty({ example: 'user:read', description: '关联权限编码', nullable: true })
|
||||
permission: string | null;
|
||||
|
||||
@ApiProperty({ example: false, description: '是否外链' })
|
||||
isExternal: boolean;
|
||||
|
||||
@@ -216,12 +190,21 @@ export class MenuTreeNodeDto implements MenuTreeNode {
|
||||
@ApiProperty({ example: 'Users', description: 'Lucide 图标名', nullable: true })
|
||||
icon: string | null;
|
||||
|
||||
@ApiProperty({ example: 'user:read', description: '关联权限编码', nullable: true })
|
||||
permission: string | null;
|
||||
@ApiProperty({ example: false, description: '是否外部链接' })
|
||||
isExternal: boolean;
|
||||
|
||||
@ApiProperty({ example: false, description: '是否隐藏' })
|
||||
isHidden: boolean;
|
||||
|
||||
@ApiProperty({ example: false, description: '是否静态菜单' })
|
||||
isStatic: boolean;
|
||||
|
||||
@ApiProperty({ example: true, description: '是否启用' })
|
||||
isEnabled: boolean;
|
||||
|
||||
@ApiProperty({ example: 0, description: '排序' })
|
||||
sort: number;
|
||||
|
||||
@ApiProperty({ example: { keepAlive: true }, description: '元数据', nullable: true })
|
||||
meta: MenuMeta | null;
|
||||
|
||||
|
||||
@@ -30,8 +30,6 @@ import { PrismaService } from '@/prisma/prisma.service';
|
||||
type: true,
|
||||
path: true,
|
||||
icon: true,
|
||||
component: true,
|
||||
permission: true,
|
||||
isExternal: true,
|
||||
isHidden: true,
|
||||
isEnabled: true,
|
||||
@@ -232,8 +230,11 @@ export class MenuService extends CrudService<
|
||||
type: menu.type as MenuType,
|
||||
path: menu.path,
|
||||
icon: menu.icon,
|
||||
permission: menu.permission,
|
||||
isExternal: menu.isExternal,
|
||||
isHidden: menu.isHidden,
|
||||
isStatic: menu.isStatic,
|
||||
isEnabled: menu.isEnabled,
|
||||
sort: menu.sort,
|
||||
meta: menu.meta as MenuMeta | null,
|
||||
children: [],
|
||||
});
|
||||
|
||||
@@ -211,8 +211,6 @@ export class RoleService extends CrudService<
|
||||
type: rm.menu.type as RoleDetailResponseDto['menus'][0]['type'],
|
||||
path: rm.menu.path,
|
||||
icon: rm.menu.icon,
|
||||
component: rm.menu.component,
|
||||
permission: rm.menu.permission,
|
||||
isExternal: rm.menu.isExternal,
|
||||
isHidden: rm.menu.isHidden,
|
||||
isEnabled: rm.menu.isEnabled,
|
||||
|
||||
Reference in New Issue
Block a user