|
@@ -1,6 +1,6 @@
|
|
import { UserEntity } from '@app/infra/entities';
|
|
import { UserEntity } from '@app/infra/entities';
|
|
import { BadRequestException, Inject, Injectable, Logger, NotFoundException } from '@nestjs/common';
|
|
import { BadRequestException, Inject, Injectable, Logger, NotFoundException } from '@nestjs/common';
|
|
-import { randomBytes } from 'crypto';
|
|
|
|
|
|
+import { createHash, randomBytes } from 'crypto';
|
|
import { ReadStream } from 'fs';
|
|
import { ReadStream } from 'fs';
|
|
import { IAlbumRepository } from '../album/album.repository';
|
|
import { IAlbumRepository } from '../album/album.repository';
|
|
import { IAssetRepository } from '../asset/asset.repository';
|
|
import { IAssetRepository } from '../asset/asset.repository';
|
|
@@ -108,7 +108,8 @@ export class UserService {
|
|
authUser: AuthUserDto,
|
|
authUser: AuthUserDto,
|
|
fileInfo: Express.Multer.File,
|
|
fileInfo: Express.Multer.File,
|
|
): Promise<CreateProfileImageResponseDto> {
|
|
): Promise<CreateProfileImageResponseDto> {
|
|
- const updatedUser = await this.userCore.createProfileImage(authUser, fileInfo.path);
|
|
|
|
|
|
+ const hash = createHash('md5').update(fileInfo.buffer).digest('hex');
|
|
|
|
+ const updatedUser = await this.userCore.createProfileImage(authUser, fileInfo.path, hash);
|
|
return mapCreateProfileImageResponse(updatedUser.id, updatedUser.profileImagePath);
|
|
return mapCreateProfileImageResponse(updatedUser.id, updatedUser.profileImagePath);
|
|
}
|
|
}
|
|
|
|
|