Split creators out of identity

This commit is contained in:
Jonathan Bourdon
2024-07-31 23:29:26 -04:00
parent bbcc7a8a33
commit 2b30e1a03c
105 changed files with 1497 additions and 7490 deletions

View File

@@ -1,5 +1,4 @@
using Hutopy.Application.Users.Queries;
using Hutopy.Application.Users.Queries.GetCurrentUser;
using Hutopy.Application.Users.Queries.GetCurrentUser;
namespace Hutopy.Web.Endpoints;

View File

@@ -9,31 +9,19 @@ public class UpdateMyUser : EndpointGroupBase
app.MapGroup(this)
.RequireAuthorization()
.MapPost(UpdateCurrentUserProfilePicture, "/profile-picture")
.MapPost(UpdateCurrentUserBannerPicture, "/banner-picture")
.MapPost(UpdateCurrentUserWebsiteIcon, "/website-icon")
.MapPatch("/profile", UpdateCurrentUser);
}
private static async Task<IResult> UpdateCurrentUser(ISender sender, UpdateCurrentUserCommand command)
{
return await sender.Send(command);
}
private static async Task<IResult> UpdateCurrentUserProfilePicture(ISender sender, MemoryStream stream, string url = "")
private static async Task<IResult> UpdateCurrentUserProfilePicture(
ISender sender,
IFormFile formFile)
{
var command = new UploadProfilePictureCommand { ProfilePicture = stream, ProfilePictureUrl = url};
return await sender.Send(command);
}
private static async Task<IResult> UpdateCurrentUserBannerPicture(ISender sender, MemoryStream stream, string url = "")
{
var command = new UploadBannerPictureCommand { BannerPicture = stream, BannerPictureUrl = url};
return await sender.Send(command);
}
private static async Task<IResult> UpdateCurrentUserWebsiteIcon(ISender sender, MemoryStream stream, string url = "")
{
var command = new UploadWebsiteIconCommand { WebsiteIcon = stream, WebsitePictureUrl = url};
var command = new UploadProfilePictureCommand { File = formFile };
return await sender.Send(command);
}
}

View File

@@ -10,7 +10,8 @@ public class Users : EndpointGroupBase
app.MapGroup(this)
.MapPost(CreateUser)
.MapPost(Login, "/login")
.MapGet(GetUser);
.MapGet(GetUserById, "/id")
.MapGet(GetUserByUserName, "/user-name");
}
private static async Task<IResult> CreateUser(ISender sender, CreateUserCommand command)
@@ -18,7 +19,14 @@ public class Users : EndpointGroupBase
return await sender.Send(command);
}
private static async Task<UserDto> GetUser(ISender sender, [AsParameters] GetUserQuery query)
private static async Task<UserDto> GetUserById(ISender sender,
[AsParameters] GetUserByIdQuery query)
{
return await sender.Send(query);
}
private static async Task<UserDto> GetUserByUserName(ISender sender,
[AsParameters] GetUserByUserNameQuery query)
{
return await sender.Send(query);
}