From 610b03d16c79f0b580f7072698fda5388c4ca80e Mon Sep 17 00:00:00 2001 From: martabal <74269598+martabal@users.noreply.github.com> Date: Wed, 1 Nov 2023 21:02:34 +0100 Subject: [PATCH] pr feedback --- server/src/domain/user/user.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/domain/user/user.service.ts b/server/src/domain/user/user.service.ts index fc5fb8b58..8f07fb412 100644 --- a/server/src/domain/user/user.service.ts +++ b/server/src/domain/user/user.service.ts @@ -93,10 +93,10 @@ export class UserService { authUser: AuthUserDto, fileInfo: Express.Multer.File, ): Promise { - const user = await this.findOrFail(authUser.id, { withDeleted: false }); + const { profileImagePath: oldpath } = await this.findOrFail(authUser.id, { withDeleted: false }); const updatedUser = await this.userRepository.update(authUser.id, { profileImagePath: fileInfo.path }); - if (user.profileImagePath !== '') { - const files = [user.profileImagePath]; + if (oldpath !== '') { + const files = [oldpath]; await this.jobRepository.queue({ name: JobName.DELETE_FILES, data: { files } }); } return mapCreateProfileImageResponse(updatedUser.id, updatedUser.profileImagePath);