feat: 用户登录信息接口
This commit is contained in:
1 parent
d152cc0e9b
commit
1bce0d9187
3 files changed
+16
No files matched your search
@@ -0,0 +1,4 @@
|
|||||||
|
import { Controller } from '@nestjs/common';
|
||||||
|
|
||||||
|
@Controller('articles')
|
||||||
|
export class ArticleController {}
|
||||||
@@ -46,4 +46,14 @@ export class UserController {
|
|||||||
total,
|
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 {
|
export class CreateTokenRequest {
|
||||||
@ApiProperty({
|
@ApiProperty({
|
||||||
required: true,
|
required: true,
|
||||||
|
example: 'admin',
|
||||||
})
|
})
|
||||||
@IsNotEmpty({ message: '用户名不能为空' })
|
@IsNotEmpty({ message: '用户名不能为空' })
|
||||||
username: string;
|
username: string;
|
||||||
@@ -11,6 +12,7 @@ export class CreateTokenRequest {
|
|||||||
@IsNotEmpty({ message: '密码不能为空' })
|
@IsNotEmpty({ message: '密码不能为空' })
|
||||||
@ApiProperty({
|
@ApiProperty({
|
||||||
required: true,
|
required: true,
|
||||||
|
example: 'admin123',
|
||||||
})
|
})
|
||||||
password: string;
|
password: string;
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user