feat: save language to BE

This commit is contained in:
lleohao
2024-09-10 08:52:52 +00:00
parent 637cd15ab4
commit 49900050f7
10 changed files with 48 additions and 29 deletions

View File

@ -12,4 +12,8 @@ export class UpdateUserDto extends PartialType(
@IsOptional()
@IsBoolean()
fullPageWidth: boolean;
@IsOptional()
@IsString()
language: string;
}

View File

@ -33,6 +33,13 @@ export class UserService {
);
}
if (typeof updateUserDto.language !== 'undefined') {
return this.updateUserLanguagePreference(
userId,
updateUserDto.language,
);
}
if (updateUserDto.name) {
user.name = updateUserDto.name;
}
@ -59,4 +66,8 @@ export class UserService {
fullPageWidth,
);
}
async updateUserLanguagePreference(userId: string, language: string) {
return this.userRepo.updatePreference(userId, 'language', language);
}
}