Item.cs 558 B

12345678910111213141516171819202122
  1. using MediatR;
  2. using Web.Api.Common;
  3. namespace Web.Api.Endpoints.Document;
  4. internal sealed class Item : IEndpoint
  5. {
  6. public void MapEndpoint(IEndpointRouteBuilder app)
  7. {
  8. app.MapGet("api/document/{code}", async (
  9. string code,
  10. ISender sender,
  11. CancellationToken ct
  12. ) => {
  13. var result = await sender.Send(new Application.Features.Api.Document.GetByCode.Query(code), ct);
  14. return ApiResponse.Ok(result);
  15. })
  16. .WithTags("Document")
  17. .AllowAnonymous();
  18. }
  19. }