mirror of
https://github.com/certd/certd.git
synced 2026-04-24 04:17:25 +08:00
chore: 1
This commit is contained in:
@@ -49,6 +49,9 @@ export class RoleController extends CrudController<RoleService> {
|
||||
@Query('id')
|
||||
id: number
|
||||
) {
|
||||
if (id === 1) {
|
||||
throw new Error('不能删除默认的管理员角色');
|
||||
}
|
||||
return await super.delete(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,8 +73,11 @@ export class UserController extends CrudController<UserService> {
|
||||
@Post('/delete', { summary: 'sys:auth:user:remove' })
|
||||
async delete(
|
||||
@Query('id')
|
||||
id : number
|
||||
id: number
|
||||
) {
|
||||
if (id === 1) {
|
||||
throw new Error('不能删除默认的管理员用户');
|
||||
}
|
||||
return await super.delete(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,4 +66,6 @@ export class UserEntity {
|
||||
static of(user: Partial<UserEntity>) {
|
||||
return Object.assign(new UserEntity(), user);
|
||||
}
|
||||
|
||||
roleIds: number[];
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { BaseController } from '../../../basic/base-controller.js';
|
||||
import { Constants } from '../../../basic/constants.js';
|
||||
import { UserService } from '../../authority/service/user-service.js';
|
||||
import { getPlusInfo } from '@certd/pipeline';
|
||||
import { RoleService } from '../../authority/service/role-service.js';
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -11,10 +12,13 @@ import { getPlusInfo } from '@certd/pipeline';
|
||||
export class MineController extends BaseController {
|
||||
@Inject()
|
||||
userService: UserService;
|
||||
@Inject()
|
||||
roleService: RoleService;
|
||||
@Post('/info', { summary: Constants.per.authOnly })
|
||||
public async info() {
|
||||
const userId = this.getUserId();
|
||||
const user = await this.userService.info(userId);
|
||||
user.roleIds = await this.roleService.getRoleIdsByUserId(userId);
|
||||
delete user.password;
|
||||
return this.ok(user);
|
||||
}
|
||||
|
||||
@@ -27,4 +27,5 @@ export class UserSettingsEntity {
|
||||
default: () => 'CURRENT_TIMESTAMP',
|
||||
})
|
||||
updateTime: Date;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user