using Application.Abstractions.Data; using Application.Abstractions.Messaging; using Microsoft.EntityFrameworkCore; namespace Application.Features.Api.Studio.Dashboard.GetDashboard; internal sealed class Handler(IAppDbContext db) : IQueryHandler { private static readonly Response Empty = new(null); public async Task Handle(Query request, CancellationToken ct) { // ── 채널 정보 ── var channel = await db.Channel.AsNoTracking().Where(c => c.MemberID == request.MemberID && c.IsActive).Select(c => new { c.ID, c.SID, c.Name, c.ThumbnailUrl, c.IsVerified, c.SubscriberCount }).FirstOrDefaultAsync(ct); if (channel is null) { return Empty; } var channelInfo = new ChannelInfo( channel.ID, channel.SID, channel.Name, channel.ThumbnailUrl, channel.IsVerified, channel.SubscriberCount ); return new Response(channelInfo); } }