diff --git a/apps/api/src/modules/system/menu/menu.service.ts b/apps/api/src/modules/system/menu/menu.service.ts index 57be777..ef31b69 100644 --- a/apps/api/src/modules/system/menu/menu.service.ts +++ b/apps/api/src/modules/system/menu/menu.service.ts @@ -70,6 +70,9 @@ export class MenuService { const roleIds = await this.roleService.getRoleIdsByUser(uid) let menus: MenuEntity[] = [] + if (isEmpty(roleIds)) + return generatorRouters([]) + if (this.roleService.hasAdminRole(roleIds)) { menus = await this.menuRepository.find({ order: { orderNo: 'ASC' } }) } diff --git a/apps/api/src/modules/user/dto/user.dto.ts b/apps/api/src/modules/user/dto/user.dto.ts index 6bd7701..a31d945 100644 --- a/apps/api/src/modules/user/dto/user.dto.ts +++ b/apps/api/src/modules/user/dto/user.dto.ts @@ -18,9 +18,6 @@ import { isEmpty } from 'lodash' import { PagerDto } from '~/common/dto/pager.dto' -import { UserEntity } from '~/modules/user/entities/user.entity' -import { IsUnique } from '~/shared/database/constraints/unique.constraint' - export class UserDto { @ApiProperty({ description: '登录账号', example: 'kz-admin' }) @IsString() @@ -54,7 +51,6 @@ export class UserDto { nickname: string @ApiProperty({ description: '邮箱', example: 'hi@kuizuo.cn' }) - @IsUnique(UserEntity, { message: '邮箱已被注册' }) @IsEmail() @ValidateIf(o => !isEmpty(o.email)) email: string