Items.cs 609 B

1234567891011121314151617181920212223242526
  1. using MediatR;
  2. using Web.Api.Common;
  3. namespace Web.Api.Endpoints.Popup;
  4. internal sealed class Items : IEndpoint
  5. {
  6. public sealed record Request(
  7. string Code
  8. );
  9. public void MapEndpoint(IEndpointRouteBuilder app)
  10. {
  11. app.MapPost("api/popups", async (
  12. Request request,
  13. ISender sender,
  14. CancellationToken ct
  15. ) => {
  16. return ApiResponse.Ok(
  17. await sender.Send(new Application.Features.Api.Popup.GetAll.Query(request.Code), ct)
  18. );
  19. })
  20. .WithTags("Popup")
  21. .AllowAnonymous();
  22. }
  23. }