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