Skip to content

Commit

Permalink
Merge pull request #779 from King-Mikaelson/feat/profile-pic
Browse files Browse the repository at this point in the history
fix: implemented fix for profile picture
  • Loading branch information
Homoakin619 authored Aug 13, 2024
2 parents 5f8904f + 9343ca6 commit d911100
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/modules/profile/entities/profile.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ export class Profile extends AbstractBaseEntity {

@DeleteDateColumn()
deletedAt?: Date;

}
8 changes: 5 additions & 3 deletions src/modules/profile/profile.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ export class ProfileService {
throw new NotFoundException('Profile not found');
}

const profileData = {...profile, avatar_url:profile.profile_pic_url}

const responseData = {
message: 'Successfully fetched profile',
data: profile,
data:profileData,
};

return responseData;
Expand Down Expand Up @@ -122,7 +124,7 @@ export class ProfileService {
userId: string,
uploadProfilePicDto: UploadProfilePicDto,
baseUrl: string
): Promise<{ status: string; message: string; data: { profile_picture_url: string } }> {
): Promise<{ status: string; message: string; data: { avatar_url: string } }> {
if (!uploadProfilePicDto.avatar) {
throw new CustomHttpException(SYS_MSG.NO_FILE_FOUND, HttpStatus.BAD_REQUEST);
}
Expand Down Expand Up @@ -174,7 +176,7 @@ export class ProfileService {
resolve({
status: "success",
message: SYS_MSG.PICTURE_UPDATED,
data: { profile_picture_url: updatedProfile.profile_pic_url },
data: { avatar_url: updatedProfile.profile_pic_url },
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/modules/profile/tests/profile.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ describe('ProfileService', () => {
expect(result).toEqual({
status: 'success',
message: PICTURE_UPDATED,
data: { profile_picture_url: `${baseUrl}/uploads/${userId}.jpg` },
data: { avatar_url: `${baseUrl}/uploads/${userId}.jpg` },
});
expect(sharp).toHaveBeenCalled();
expect(profileRepository.update).toHaveBeenCalled();
Expand Down

0 comments on commit d911100

Please sign in to comment.