VerifyEmail.cs 707 B

123456789101112131415161718192021222324252627
  1. using MediatR;
  2. using Web.Api.Common;
  3. using Web.Api.Extensions;
  4. namespace Web.Api.Endpoints.MyPage;
  5. internal sealed class VerifyEmail : IEndpoint
  6. {
  7. public void MapEndpoint(IEndpointRouteBuilder app)
  8. {
  9. app.MapGet("api/mypage/email/verify", async (
  10. string token,
  11. ISender sender,
  12. CancellationToken ct
  13. ) => {
  14. var query = new Application.Features.Api.MyPage.VerifyEmail.Query(token);
  15. var result = await sender.Send(query, ct);
  16. return result.Match(
  17. () => ApiResponse.Ok(),
  18. CustomResults.Problem
  19. );
  20. })
  21. .WithTags("MyPage")
  22. .AllowAnonymous();
  23. }
  24. }