pr feedback

This commit is contained in:
martabal 2023-11-01 21:02:34 +01:00
parent 3d6eadb595
commit 610b03d16c
No known key found for this signature in database
GPG key ID: C00196E3148A52BD

View file

@ -93,10 +93,10 @@ export class UserService {
authUser: AuthUserDto,
fileInfo: Express.Multer.File,
): Promise<CreateProfileImageResponseDto> {
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);