From 90d76c32ce9813aa5bcd0a3ef1d194ad1e050755 Mon Sep 17 00:00:00 2001 From: Dominic Villemure Date: Sun, 30 Jun 2024 12:39:24 -0400 Subject: [PATCH] Add storedDataUrls to GetCurrentUser --- src/Application/Common/Models/UserModel.cs | 1 + src/Application/Users/Models/StoredDataUrlsModel.cs | 8 ++++++++ .../Users/Queries/GetCurrentUser/GetCurrentUser.cs | 2 ++ .../Users/Queries/GetCurrentUser/UserDto.cs | 2 ++ src/Infrastructure/Identity/IdentityService.cs | 12 ++++++++++++ 5 files changed, 25 insertions(+) create mode 100644 src/Application/Users/Models/StoredDataUrlsModel.cs diff --git a/src/Application/Common/Models/UserModel.cs b/src/Application/Common/Models/UserModel.cs index 9fceab9..fb76755 100644 --- a/src/Application/Common/Models/UserModel.cs +++ b/src/Application/Common/Models/UserModel.cs @@ -19,5 +19,6 @@ public class UserModel public string Description { get; init; } = string.Empty; public SocialNetworksModel SocialNetworks { get; init; } = new(); public ProfileColorsModel ProfileColors { get; init; } = new(); + public StoredDataUrlsModel StoredDataUrls { get; init; } = new(); public string ProfilePictureUrl { get; set; } = string.Empty; } diff --git a/src/Application/Users/Models/StoredDataUrlsModel.cs b/src/Application/Users/Models/StoredDataUrlsModel.cs new file mode 100644 index 0000000..0539508 --- /dev/null +++ b/src/Application/Users/Models/StoredDataUrlsModel.cs @@ -0,0 +1,8 @@ +namespace Hutopy.Application.Users.Models; + +public class StoredDataUrlsModel +{ + public string BannerPictureUrl { get; set; } = string.Empty; + public string ProfilePictureUrl { get; set; } = string.Empty; + public string WebsiteIconUrl { get; set; } = string.Empty; +} diff --git a/src/Application/Users/Queries/GetCurrentUser/GetCurrentUser.cs b/src/Application/Users/Queries/GetCurrentUser/GetCurrentUser.cs index eeb9f7c..2fef51c 100644 --- a/src/Application/Users/Queries/GetCurrentUser/GetCurrentUser.cs +++ b/src/Application/Users/Queries/GetCurrentUser/GetCurrentUser.cs @@ -41,6 +41,8 @@ public class GetCurrentUserQueryHandler( About = identityUser.About ?? "", Description = identityUser.Description ?? "", SocialNetworks = identityUser.SocialNetworks, + ProfileColors = identityUser.ProfileColors, + StoredDataUrls = identityUser.StoredDataUrls, UserTransactions = transactions, TotalBalance = transactions.Sum(x => x.Amount), UserRoles = roles, diff --git a/src/Application/Users/Queries/GetCurrentUser/UserDto.cs b/src/Application/Users/Queries/GetCurrentUser/UserDto.cs index ec2cc5d..24cb7fd 100644 --- a/src/Application/Users/Queries/GetCurrentUser/UserDto.cs +++ b/src/Application/Users/Queries/GetCurrentUser/UserDto.cs @@ -18,6 +18,8 @@ public class UserDto public string About { get; init; } = string.Empty; public string Description { get; init; } = string.Empty; public SocialNetworksModel SocialNetworks { get; init; } = new(); + public ProfileColorsModel ProfileColors { get; init; } = new(); + public StoredDataUrlsModel StoredDataUrls { get; init; } = new(); public List UserTransactions { get; init; } = []; public IList UserRoles { get; init; } = []; public required decimal TotalBalance { get; init; } diff --git a/src/Infrastructure/Identity/IdentityService.cs b/src/Infrastructure/Identity/IdentityService.cs index c0f8a9b..d159de4 100644 --- a/src/Infrastructure/Identity/IdentityService.cs +++ b/src/Infrastructure/Identity/IdentityService.cs @@ -171,6 +171,12 @@ public class IdentityService( BannerBottom = response.ProfileColors.BannerBottom, Accent = response.ProfileColors.Accent, Menu = response.ProfileColors.Menu + }, + StoredDataUrls = new StoredDataUrlsModel + { + ProfilePictureUrl = response.StoredDataUrls.ProfilePictureUrl, + BannerPictureUrl = response.StoredDataUrls.BannerPictureUrl, + WebsiteIconUrl = response.StoredDataUrls.WebsiteIconUrl, } }; @@ -215,6 +221,12 @@ public class IdentityService( BannerBottom = response.ProfileColors.BannerBottom, Accent = response.ProfileColors.Accent, Menu = response.ProfileColors.Menu + }, + StoredDataUrls = new StoredDataUrlsModel + { + ProfilePictureUrl = response.StoredDataUrls.ProfilePictureUrl, + BannerPictureUrl = response.StoredDataUrls.BannerPictureUrl, + WebsiteIconUrl = response.StoredDataUrls.WebsiteIconUrl, } };