Split creators out of identity
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user