| 123456789101112131415161718192021222324252627282930313233343536373839 |
- using MediatR;
- using Web.Api.Extensions;
- using Web.Api.Common;
- namespace Web.Api.Endpoints.Auth;
- internal sealed class Register : IEndpoint
- {
- public sealed record Request(
- string Email,
- string Password,
- string? Name
- );
- public void MapEndpoint(IEndpointRouteBuilder app)
- {
- // ȸ¿ø°¡ÀÔ ¿äû
- app.MapPost("api/auth/register", async (
- Request request,
- ISender sender,
- CancellationToken ct
- ) => {
- var command = new Application.Features.Api.Auth.Register.Command(
- request.Email,
- request.Password,
- request.Name
- );
- var result = await sender.Send(command, ct);
- return result.Match(
- result => ApiResponse.Created(result),
- CustomResults.Problem
- );
- })
- .WithTags("Auth")
- .AllowAnonymous();
- }
- }
|