feat(users): 添加用户语言偏好字段
- 在 User 模型中添加 language 字段,默认值为 'zh-CN' - 更新 UpdateUserDto 以支持语言偏好参数 - 在用户更新服务中实现语言偏好的保存逻辑
This commit is contained in:
@@ -222,7 +222,7 @@ export class UsersService {
|
||||
|
||||
// 更新用户昵称、头像
|
||||
async updateUser(updateUserDto: UpdateUserDto, userId: string): Promise<UpdateUserResponseDto> {
|
||||
const { name, avatar, gender, birthDate, dailyStepsGoal, dailyCaloriesGoal, pilatesPurposes, weight, initialWeight, targetWeight, height, activityLevel } = updateUserDto;
|
||||
const { name, avatar, gender, birthDate, language, dailyStepsGoal, dailyCaloriesGoal, pilatesPurposes, weight, initialWeight, targetWeight, height, activityLevel } = updateUserDto;
|
||||
|
||||
this.logger.log(`updateUser: ${JSON.stringify(updateUserDto, null, 2)}`);
|
||||
|
||||
@@ -252,6 +252,10 @@ export class UsersService {
|
||||
user.birthDate = dayjs(birthDate * 1000).startOf('day').toDate();
|
||||
userChanges.birthDate = birthDate;
|
||||
}
|
||||
if (language) {
|
||||
user.language = language;
|
||||
userChanges.language = language;
|
||||
}
|
||||
|
||||
this.logger.log(`updateUser user: ${JSON.stringify(user, null, 2)}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user