feat(users): 更新用户接口添加EFICHOPER(builderId,u-formatIdFast生成提)录制
This commit is contained in:
@@ -4,11 +4,6 @@ import { ResponseCode } from 'src/base.dto';
|
|||||||
import { Gender, User } from '../models/user.model';
|
import { Gender, User } from '../models/user.model';
|
||||||
|
|
||||||
export class UpdateUserDto {
|
export class UpdateUserDto {
|
||||||
@IsString({ message: '用户ID必须是字符串' })
|
|
||||||
@IsNotEmpty({ message: '用户ID不能为空' })
|
|
||||||
@ApiProperty({ description: '用户ID', example: '123' })
|
|
||||||
userId: string;
|
|
||||||
|
|
||||||
@IsString({ message: '用户名必须是字符串' })
|
@IsString({ message: '用户名必须是字符串' })
|
||||||
@MinLength(1, { message: '用户名长度不能少于1个字符' })
|
@MinLength(1, { message: '用户名长度不能少于1个字符' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
|
|||||||
@@ -76,8 +76,8 @@ export class UsersController {
|
|||||||
// 更新用户昵称、头像
|
// 更新用户昵称、头像
|
||||||
@UseGuards(JwtAuthGuard)
|
@UseGuards(JwtAuthGuard)
|
||||||
@Put('update')
|
@Put('update')
|
||||||
async updateUser(@Body() updateUserDto: UpdateUserDto): Promise<UpdateUserResponseDto> {
|
async updateUser(@Body() updateUserDto: UpdateUserDto, @CurrentUser() user: AccessTokenPayload): Promise<UpdateUserResponseDto> {
|
||||||
return this.usersService.updateUser(updateUserDto);
|
return this.usersService.updateUser(updateUserDto, user.sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apple 登录
|
// Apple 登录
|
||||||
|
|||||||
@@ -180,8 +180,8 @@ export class UsersService {
|
|||||||
|
|
||||||
|
|
||||||
// 更新用户昵称、头像
|
// 更新用户昵称、头像
|
||||||
async updateUser(updateUserDto: UpdateUserDto): Promise<UpdateUserResponseDto> {
|
async updateUser(updateUserDto: UpdateUserDto, userId: string): Promise<UpdateUserResponseDto> {
|
||||||
const { userId, name, avatar, gender, birthDate, dailyStepsGoal, dailyCaloriesGoal, pilatesPurposes, weight, initialWeight, targetWeight, height, activityLevel } = updateUserDto;
|
const { name, avatar, gender, birthDate, dailyStepsGoal, dailyCaloriesGoal, pilatesPurposes, weight, initialWeight, targetWeight, height, activityLevel } = updateUserDto;
|
||||||
|
|
||||||
this.logger.log(`updateUser: ${JSON.stringify(updateUserDto, null, 2)}`);
|
this.logger.log(`updateUser: ${JSON.stringify(updateUserDto, null, 2)}`);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user