feat: 用户登录信息接口
This commit is contained in:
1 parent
d152cc0e9b
commit
1bce0d9187
3 files changed
+16
No files matched your search
@@ -46,4 +46,14 @@ export class UserController {
|
||||
total,
|
||||
);
|
||||
}
|
||||
|
||||
@Get('current')
|
||||
@ApiBearerAuth()
|
||||
@ApiOkResponse({
|
||||
description: '获取当前登录用户信息',
|
||||
type: UserVo,
|
||||
})
|
||||
async current() {
|
||||
return UserMapper.toVo(this.userService.getCurrentUser());
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import { IsNotEmpty } from 'class-validator';
|
||||
export class CreateTokenRequest {
|
||||
@ApiProperty({
|
||||
required: true,
|
||||
example: 'admin',
|
||||
})
|
||||
@IsNotEmpty({ message: '用户名不能为空' })
|
||||
username: string;
|
||||
@@ -11,6 +12,7 @@ export class CreateTokenRequest {
|
||||
@IsNotEmpty({ message: '密码不能为空' })
|
||||
@ApiProperty({
|
||||
required: true,
|
||||
example: 'admin123',
|
||||
})
|
||||
password: string;
|
||||
}
|
||||
Reference in new issue
Block a user