| 12345678910111213141516171819202122232425262728293031 |
- using MediatR;
- using Web.Api.Extensions;
- using Web.Api.Common;
- namespace Web.Api.Endpoints.Auth;
- internal sealed class ForgotPassword : IEndpoint
- {
- public sealed record Request(string Email);
- public void MapEndpoint(IEndpointRouteBuilder app)
- {
- // 비밀번호 재설정 요청
- app.MapPost("api/auth/forgot-password", async (
- Request request,
- ISender sender,
- CancellationToken ct
- ) =>
- {
- var command = new Application.Features.Api.Auth.ForgotPassword.Command(request.Email);
- var result = await sender.Send(command, ct);
- return result.Match(
- () => ApiResponse.Ok("이메일 인증 확인 후 비밀번호를 변경할 수 있습니다."),
- CustomResults.Problem
- );
- })
- .WithTags("Auth")
- .AllowAnonymous();
- }
- }
|