22 lines
670 B
C#
22 lines
670 B
C#
using Hutopy.Application.Users.Commands;
|
|
using Hutopy.Domain.Interfaces;
|
|
using Hutopy.Infrastructure.Identity;
|
|
|
|
namespace Hutopy.Web.Endpoints;
|
|
|
|
public class Users : EndpointGroupBase
|
|
{
|
|
public override void Map(WebApplication app)
|
|
{
|
|
app.MapGroup(this)
|
|
.MapPost(CreateUser)
|
|
.MapIdentityApi<ApplicationUser>();
|
|
}
|
|
|
|
private static async Task<Guid> CreateUser(ISender sender, CreateUserCommand command, IUserService userService)
|
|
{
|
|
await userService.CreateUserAsync(command.EmailAddress, command.UserName, command.FirstName, command.LastName, command.Password);
|
|
return await sender.Send(command);
|
|
}
|
|
}
|