Added profile ProfileColors and Profile images
This commit is contained in:
@@ -16,6 +16,7 @@ public class UpdateCurrentUserCommand : IRequest<string>
|
||||
public required string About { get; init; }
|
||||
public required string Description { get; init; }
|
||||
public required SocialNetworksModel SocialNetworks { get; init; }
|
||||
public required ProfileColorsModel ProfileColors { get; init; }
|
||||
}
|
||||
|
||||
public class UpdateCurrentUserCommandHandler(IApplicationDbContext context, IIdentityService identityService) :
|
||||
@@ -27,10 +28,7 @@ public class UpdateCurrentUserCommandHandler(IApplicationDbContext context, IIde
|
||||
|
||||
if (identityUser?.Id is null) return string.Empty;
|
||||
|
||||
var result = await identityService.UpdateCurrentUserAsync(identityUser.Id, request.FirstName, request.LastName,
|
||||
request.Occupation, request.PhoneNumber, request.BirthDate,
|
||||
request.Country, request.City, request.Address, request.About,
|
||||
request.Description, request.SocialNetworks);
|
||||
var result = await identityService.UpdateCurrentUserAsync(identityUser);
|
||||
|
||||
await context.SaveChangesAsync(cancellationToken);
|
||||
|
||||
|
||||
27
src/Application/Users/Commands/UploadBannerPicture.cs
Normal file
27
src/Application/Users/Commands/UploadBannerPicture.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Hutopy.Application.AzureBlobStorage.Constants;
|
||||
using Hutopy.Application.Common.Interfaces;
|
||||
|
||||
namespace Hutopy.Application.Users.Commands;
|
||||
|
||||
public class UploadBannerPictureCommand : IRequest<string>
|
||||
{
|
||||
public required Stream BannerPicture { get; init; }
|
||||
}
|
||||
|
||||
public class UploadBannerPictureCommandHandler(IIdentityService identityService, IAzureBlobStorageService azureBlobStorageService) : IRequestHandler<UploadBannerPictureCommand, string>
|
||||
{
|
||||
public async Task<string> Handle(UploadBannerPictureCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var identityUser = await identityService.GetCurrentUserAsync();
|
||||
var currentUserId = new Guid(identityUser?.Id ?? "").ToString();
|
||||
|
||||
var blobName = $"{currentUserId}/{SubDirectoryNames.Profile}/{CommonFileNames.BannerPicture}";
|
||||
|
||||
var url = await azureBlobStorageService.UploadFileAsync(ContainerNames.Users, blobName, request.BannerPicture);
|
||||
|
||||
await identityService.UpdateCurrentUserBannerPictureUrlAsync(url);
|
||||
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ public class UploadProfilePictureCommandHandler(IIdentityService identityService
|
||||
|
||||
var url = await azureBlobStorageService.UploadFileAsync(ContainerNames.Users, blobName, request.ProfilePicture);
|
||||
|
||||
await identityService.UpdateCurrentUserProfilePictureUrlAsync(url);
|
||||
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
27
src/Application/Users/Commands/UploadWebsiteIcon.cs
Normal file
27
src/Application/Users/Commands/UploadWebsiteIcon.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Hutopy.Application.AzureBlobStorage.Constants;
|
||||
using Hutopy.Application.Common.Interfaces;
|
||||
|
||||
namespace Hutopy.Application.Users.Commands;
|
||||
|
||||
public class UploadWebsiteIconCommand : IRequest<string>
|
||||
{
|
||||
public required Stream WebsiteIcon { get; init; }
|
||||
}
|
||||
|
||||
public class UploadWebsiteIconCommandHandler(IIdentityService identityService, IAzureBlobStorageService azureBlobStorageService) : IRequestHandler<UploadWebsiteIconCommand, string>
|
||||
{
|
||||
public async Task<string> Handle(UploadWebsiteIconCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var identityUser = await identityService.GetCurrentUserAsync();
|
||||
var currentUserId = new Guid(identityUser?.Id ?? "").ToString();
|
||||
|
||||
var blobName = $"{currentUserId}/{SubDirectoryNames.Profile}/{CommonFileNames.WebsiteIcon}";
|
||||
|
||||
var url = await azureBlobStorageService.UploadFileAsync(ContainerNames.Users, blobName, request.WebsiteIcon);
|
||||
|
||||
await identityService.UpdateCurrentUserWebsiteIconUrlAsync(url);
|
||||
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
9
src/Application/Users/Models/ProfileColorsModel.cs
Normal file
9
src/Application/Users/Models/ProfileColorsModel.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Hutopy.Application.Users.Models;
|
||||
|
||||
public class ProfileColorsModel
|
||||
{
|
||||
public string BannerTop { get; init; } = String.Empty;
|
||||
public string BannerBottom { get; init; } = String.Empty;
|
||||
public string Accent { get; init; } = String.Empty;
|
||||
public string Menu { get; init; } = String.Empty;
|
||||
}
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
public class SocialNetworksModel
|
||||
{
|
||||
public string FacebookUrl { get; init; } = String.Empty;
|
||||
public string InstagramUrl { get; init; } = String.Empty;
|
||||
public string XUrl { get; init; } = String.Empty;
|
||||
public string LinkedInUrl { get; init; } = String.Empty;
|
||||
public string TikTokUrl { get; init; } = String.Empty;
|
||||
public string YoutubeUrl { get; init; } = String.Empty;
|
||||
public string RedditUrl { get; init; } = String.Empty;
|
||||
public string YourWebsiteUrl { get; init; } = String.Empty;
|
||||
public string FacebookUrl { get; init; } = string.Empty;
|
||||
public string InstagramUrl { get; init; } = string.Empty;
|
||||
public string XUrl { get; init; } = string.Empty;
|
||||
public string LinkedInUrl { get; init; } = string.Empty;
|
||||
public string TikTokUrl { get; init; } = string.Empty;
|
||||
public string YoutubeUrl { get; init; } = string.Empty;
|
||||
public string RedditUrl { get; init; } = string.Empty;
|
||||
public string YourWebsiteUrl { get; init; } = string.Empty;
|
||||
}
|
||||
|
||||
@@ -7,16 +7,16 @@ public class UserDto
|
||||
public Guid Id { get; init; }
|
||||
public required string FirstName { get; init; }
|
||||
public required string LastName { get; init; }
|
||||
public string UserName { get; init; } = String.Empty;
|
||||
public string Occupation { get; init; } = String.Empty;
|
||||
public string Email { get; init; } = String.Empty;
|
||||
public string Phone { get; init; } = String.Empty;
|
||||
public string BirthDate { get; init; } = String.Empty;
|
||||
public string Country { get; init; } = String.Empty;
|
||||
public string City { get; init; } = String.Empty;
|
||||
public string Address { get; init; } = String.Empty;
|
||||
public string About { get; init; } = String.Empty;
|
||||
public string Description { get; init; } = String.Empty;
|
||||
public string UserName { get; init; } = string.Empty;
|
||||
public string Occupation { get; init; } = string.Empty;
|
||||
public string Email { get; init; } = string.Empty;
|
||||
public string Phone { get; init; } = string.Empty;
|
||||
public string BirthDate { get; init; } = string.Empty;
|
||||
public string Country { get; init; } = string.Empty;
|
||||
public string City { get; init; } = string.Empty;
|
||||
public string Address { get; init; } = string.Empty;
|
||||
public string About { get; init; } = string.Empty;
|
||||
public string Description { get; init; } = string.Empty;
|
||||
public SocialNetworksModel SocialNetworks { get; init; } = new();
|
||||
public List<UserTransactionDto> UserTransactions { get; init; } = [];
|
||||
public IList<string> UserRoles { get; init; } = [];
|
||||
|
||||
Reference in New Issue
Block a user