Skip to content

Commit

Permalink
fix: getMenus without roleIds
Browse files Browse the repository at this point in the history
  • Loading branch information
kuizuo committed Dec 1, 2023
1 parent c63f12c commit f8ea159
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 3 additions & 0 deletions apps/api/src/modules/system/menu/menu.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' } })
}
Expand Down
4 changes: 0 additions & 4 deletions apps/api/src/modules/user/dto/user.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f8ea159

Please sign in to comment.