This commit is contained in:
Dominic Villemure
2024-07-04 20:47:07 -04:00
parent fb5f925976
commit 3558952634
9 changed files with 62 additions and 19 deletions

View File

@@ -41,10 +41,42 @@ public class IdentityService(
var userModel = new UserModel()
{
Id = response.Id,
UserName = response.UserName,
UserName = response.UserName ?? string.Empty,
FirstName = response.FirstName,
LastName = response.LastName,
Email = response.Email,
Email = response.Email ?? string.Empty,
Occupation = response.Occupation,
PhoneNumber = response.PhoneNumber ?? string.Empty,
BirthDate = response.BirthDate,
Country = response.Country,
City = response.City,
Address = response.Address,
About = response.About,
Description = response.Description,
SocialNetworks = new SocialNetworksModel
{
FacebookUrl = response.SocialNetworks.FacebookUrl,
InstagramUrl = response.SocialNetworks.InstagramUrl,
XUrl = response.SocialNetworks.XUrl,
LinkedInUrl = response.SocialNetworks.LinkedInUrl,
TikTokUrl = response.SocialNetworks.TikTokUrl,
YoutubeUrl = response.SocialNetworks.YoutubeUrl,
RedditUrl = response.SocialNetworks.RedditUrl,
YourWebsiteUrl = response.SocialNetworks.YourWebsiteUrl,
},
ProfileColors = new ProfileColorsModel
{
BannerTop = response.ProfileColors.BannerTop,
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,
}
};
return userModel;
@@ -88,7 +120,7 @@ public class IdentityService(
return result;
}
public async Task<Result<string>> UpdateCurrentUserAsync(UserModel userModel, string? portraitUrl)
public async Task<Result<string>> UpdateCurrentUserAsync(UserModel userModel)
{
var applicationUser = await userManager.FindByIdAsync(userModel.Id);
@@ -104,7 +136,6 @@ public class IdentityService(
applicationUser.Address = userModel.Address;
applicationUser.About = userModel.About;
applicationUser.Description = userModel.Description;
applicationUser.PortraitUrl = portraitUrl;
applicationUser.SocialNetworks = new SocialNetworks
{
FacebookUrl = userModel.SocialNetworks.FacebookUrl,
@@ -155,7 +186,6 @@ public class IdentityService(
Address = response.Address,
About = response.About,
Description = response.Description,
PortraitUrl = response.PortraitUrl,
SocialNetworks = new SocialNetworksModel
{
FacebookUrl = response.SocialNetworks.FacebookUrl,
@@ -387,7 +417,7 @@ public class IdentityService(
email: user.Email,
firstname: user.FirstName,
lastname: user.LastName,
portraitUrl: user.PortraitUrl);
profilePictureUrl: user.StoredDataUrls.ProfilePictureUrl);
return token;
}