Categories.cs 524 B

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