Merge remote-tracking branch 'origin/feature/update-current-user' into feature/update-current-user

# Conflicts:
#	src/Application/Common/Interfaces/IIdentityService.cs
#	src/Application/Common/Models/Result.cs
#	src/Application/Common/Models/UserModel.cs
#	src/Application/Users/Commands/UpdateCurrentUserCommand.cs
#	src/Application/Users/Models/SocialNetworksModel.cs
#	src/Application/Users/Queries/GetCurrentUser/GetCurrentUser.cs
#	src/Application/Users/Queries/GetCurrentUser/UserDto.cs
#	src/Infrastructure/Identity/ApplicationUser.cs
#	src/Infrastructure/Identity/IdentityService.cs
#	src/Infrastructure/Utils/GenerateJwtToken.cs
#	src/Web/Controllers/GoogleController.cs
#	src/Web/Endpoints/UpdateMyUser.cs
This commit is contained in:
Dominic Villemure
2024-07-04 20:43:04 -04:00
10 changed files with 559 additions and 10 deletions

View File

@@ -12,7 +12,7 @@ public interface IIdentityService
Task<Result> UpdateCurrentUserBannerPictureUrlAsync(string url);
Task<Result> UpdateCurrentUserProfilePictureUrlAsync(string url);
Task<Result> UpdateCurrentUserWebsiteIconUrlAsync(string url);
Task<Result<string>> UpdateCurrentUserAsync(UserModel userModel);
Task<Result<string>> UpdateCurrentUserAsync(UserModel userModel, string? portraitUrl);
Task<IList<string>> GetCurrentUserRolesAsync();
Task<UserModel?> FindUserByIdAsync(string id);
Task<UserModel?> FindUserByEmailAsync(string email);

View File

@@ -1,4 +1,4 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations.Schema;
using Hutopy.Application.Common.Interfaces;
using Hutopy.Application.Common.Models;
using Hutopy.Application.Users.Models;
@@ -19,6 +19,8 @@ public class UpdateCurrentUserCommand : IRequest<string>
public required string Description { get; init; }
public required SocialNetworksModel SocialNetworks { get; init; }
public required ProfileColorsModel ProfileColors { get; init; }
public string PortraitUrl { get; init; } = string.Empty;
[NotMapped]
private class Mapping : Profile
@@ -42,7 +44,7 @@ public class UpdateCurrentUserCommandHandler(IApplicationDbContext context, IIde
var userModel = mapper.Map<UserModel>(request);
userModel.Id = identityUser.Id;
var result = await identityService.UpdateCurrentUserAsync(userModel);
var result = await identityService.UpdateCurrentUserAsync(userModel, request.PortraitUrl);
await context.SaveChangesAsync(cancellationToken);