using System.Security.Claims; using Application.Abstractions.Messaging; using Web.Api.Common; using Web.Api.Extensions; namespace Web.Api.Endpoints.Feed; internal sealed class GetPost : IEndpoint { public void MapEndpoint(IEndpointRouteBuilder app) { app.MapGet("api/feed/post/{postID:int}", async ( int postID, ClaimsPrincipal user, ISender sender, CancellationToken ct ) => { var viewerID = user.GetMemberID(); var query = new Application.Features.Api.Feed.GetPost.Query(postID, viewerID); var result = await sender.Send(query, ct); return result.Match( data => ApiResponse.Ok(data), CustomResults.Problem ); }) .WithTags("Feed"); } }