aboutsummaryrefslogtreecommitdiff
path: root/src/Services
diff options
context:
space:
mode:
Diffstat (limited to 'src/Services')
-rw-r--r--src/Services/DevHive.Services.Models/User/UserServiceModel.cs2
-rw-r--r--src/Services/DevHive.Services/Services/ProfilePictureService.cs6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/Services/DevHive.Services.Models/User/UserServiceModel.cs b/src/Services/DevHive.Services.Models/User/UserServiceModel.cs
index ad4e553..f48c703 100644
--- a/src/Services/DevHive.Services.Models/User/UserServiceModel.cs
+++ b/src/Services/DevHive.Services.Models/User/UserServiceModel.cs
@@ -8,7 +8,7 @@ namespace DevHive.Services.Models.User
{
public class UserServiceModel : BaseUserServiceModel
{
- public string ProfilePictureURL { get; set; } = new("/assets/icons/tabler-icon-user.svg");
+ public string ProfilePictureURL { get; set; } = new(string.Empty);
public HashSet<RoleServiceModel> Roles { get; set; } = new();
diff --git a/src/Services/DevHive.Services/Services/ProfilePictureService.cs b/src/Services/DevHive.Services/Services/ProfilePictureService.cs
index 7093818..0a4c824 100644
--- a/src/Services/DevHive.Services/Services/ProfilePictureService.cs
+++ b/src/Services/DevHive.Services/Services/ProfilePictureService.cs
@@ -41,6 +41,7 @@ namespace DevHive.Services.Services
await ValidateUserExistsAsync(profilePictureServiceModel.UserId);
User user = await this._userRepository.GetByIdAsync(profilePictureServiceModel.UserId);
+ // if (user.ProfilePicture.PictureURL != ProfilePicture.DefaultURL)
if (user.ProfilePicture.Id != Guid.Empty)
{
List<string> file = new() { user.ProfilePicture.PictureURL };
@@ -76,11 +77,14 @@ namespace DevHive.Services.Services
string picUrl = (await this._cloudinaryService.UploadFilesToCloud(file))[0];
ProfilePicture profilePic = new() { PictureURL = picUrl };
+ User user = await this._userRepository.GetByIdAsync(profilePictureServiceModel.UserId);
+ profilePic.UserId = user.Id;
+ profilePic.User = user;
+
bool success = await this._profilePictureRepository.AddAsync(profilePic);
if (!success)
throw new ArgumentException("Unable to upload picture!");
- User user = await this._userRepository.GetByIdAsync(profilePictureServiceModel.UserId);
user.ProfilePicture = profilePic;
bool userProfilePicAlter = await this._userRepository.EditAsync(user.Id, user);