Files
social-media/src/Web/Endpoints/Users.cs
2024-06-09 23:03:33 -04:00

29 lines
740 B
C#

using Hutopy.Application.Users.Commands;
using Hutopy.Application.Users.Queries.GetMinimalUser;
using Hutopy.Infrastructure.Identity;
namespace Hutopy.Web.Endpoints;
public class Users : EndpointGroupBase
{
public override void Map(WebApplication app)
{
app.MapGroup(this)
.MapPost(CreateUser)
.MapGet(GetMinimalUser)
.MapIdentityApi<ApplicationUser>();
}
private static async Task<Guid> CreateUser(ISender sender, CreateUserCommand command)
{
return await sender.Send(command);
}
private static async Task<MinimalUserDto> GetMinimalUser(ISender sender, [AsParameters] GetMinimalUserQuery query)
{
return await sender.Send(query);
}
}