using MediatR; using Web.Api.Extensions; using Web.Api.Common; namespace Web.Api.Endpoints.Auth; internal sealed class Refresh : IEndpoint { public sealed record Request(string RefreshToken); public void MapEndpoint(IEndpointRouteBuilder app) { app.MapPost("api/auth/refresh", async ( Request request, ISender sender, CancellationToken ct ) => { var command = new Application.Features.Auth.RefreshToken.Command( request.RefreshToken ); var result = await sender.Send(command, ct); return result.Match( Results.Ok, CustomResults.Problem ); }) .WithTags("Auth") .AllowAnonymous(); } }