List.cs 739 B

123456789101112131415161718192021222324
  1. using Web.Api.Common;
  2. using Web.Api.Extensions;
  3. using MediatR;
  4. namespace Web.Api.Endpoints.Channel;
  5. /// <summary>채널 목록</summary>
  6. internal sealed class List : IEndpoint
  7. {
  8. public void MapEndpoint(IEndpointRouteBuilder app)
  9. {
  10. /// 전체 채널 목록 조회 (온/오프라인, 시청자 수 포함. 사이드바/메인 페이지용)
  11. app.MapGet("api/channel/list", async (ISender sender, CancellationToken ct) =>
  12. {
  13. var result = await sender.Send(new Application.Features.Api.Channel.List.Query(), ct);
  14. return result.Match(
  15. () => ApiResponse.Ok(result.Value),
  16. CustomResults.Problem
  17. );
  18. })
  19. .WithTags("Channel");
  20. }
  21. }