using System.Security.Claims; using Application.Abstractions.Messaging; using Web.Api.Common; using Web.Api.Extensions; namespace Web.Api.Endpoints.Channel; /// 현재 방송 세션의 라이브 XP 리더보드 internal sealed class LiveLeaderboard : IEndpoint { public void MapEndpoint(IEndpointRouteBuilder app) { /// identifier: @handle 또는 YouTube Channel ID (SID) app.MapGet("api/channel/{identifier}/live-leaderboard", async ( string identifier, int? maxRank, ClaimsPrincipal user, ISender sender, CancellationToken ct ) => { int? viewerID = null; if (user.Identity?.IsAuthenticated == true) { viewerID = user.GetMemberID(); } var query = new Application.Features.Api.Channel.GetLiveLeaderboard.Query(identifier, maxRank, viewerID); var data = await sender.Send(query, ct); return ApiResponse.Ok(data); }) .WithTags("Channel") .AllowAnonymous() .RequireFeature(c => c.Channel); } }