mirror of
https://github.com/aleksilassila/reiverr.git
synced 2026-04-27 03:05:10 +02:00
fix: user not saving
This commit is contained in:
@@ -138,10 +138,8 @@ export class UsersController {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
const user = await this.usersService.findOne(id);
|
||||
|
||||
const updated = await this.usersService
|
||||
.update(user, callerUser, updateUserDto)
|
||||
.update(id, callerUser, updateUserDto)
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
if (e === UserServiceError.PasswordMismatch) {
|
||||
|
||||
@@ -79,10 +79,14 @@ export class UsersService {
|
||||
}
|
||||
|
||||
async update(
|
||||
user: User,
|
||||
userId: string,
|
||||
callerUser: User,
|
||||
updateUserDto: UpdateUserDto,
|
||||
): Promise<User> {
|
||||
const user = await this.userRepository.findOne({ where: { id: userId } });
|
||||
|
||||
if (!user) throw new Error('Update user: User not found');
|
||||
|
||||
if (updateUserDto.name) user.name = updateUserDto.name;
|
||||
|
||||
if (updateUserDto.oldPassword !== updateUserDto.password) {
|
||||
|
||||
Reference in New Issue
Block a user