Enhance schedule and show management: add season and episode information to ScheduleEntryDto, update ListShowsQueryHandler to include season counts, and modify frontend components to display this new data. Improve EPG handling by consolidating program entries into blocks for better clarity in the streaming interface.
This commit is contained in:
+14
-1
@@ -2,6 +2,7 @@ using LiteCqrs;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using TeleWave.Application.Common.Interfaces;
|
||||
using TeleWave.Application.Common.Models;
|
||||
using TeleWave.Application.Library;
|
||||
|
||||
namespace TeleWave.Application.Broadcast.GetSchedule;
|
||||
|
||||
@@ -36,6 +37,17 @@ public sealed class GetChannelScheduleQueryHandler(IAppDbContext dbContext)
|
||||
.Select(s => new { s.Id, s.Name })
|
||||
.ToDictionaryAsync(s => s.Id, s => s.Name, cancellationToken);
|
||||
|
||||
// Имена ассетов программ — чтобы показать реальную метку S16E03 в расписании админки.
|
||||
var assetIds = entries
|
||||
.Where(e => e.Kind == Domain.Broadcast.ScheduleEntryKind.Program)
|
||||
.Select(e => e.MediaAssetId)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
var assetNames = await dbContext.MediaAssets.AsNoTracking()
|
||||
.Where(a => assetIds.Contains(a.Id))
|
||||
.Select(a => new { a.Id, a.OriginalFileName })
|
||||
.ToDictionaryAsync(a => a.Id, a => a.OriginalFileName, cancellationToken);
|
||||
|
||||
var dtos = entries
|
||||
.Select(e => new ScheduleEntryDto(
|
||||
e.Id,
|
||||
@@ -45,7 +57,8 @@ public sealed class GetChannelScheduleQueryHandler(IAppDbContext dbContext)
|
||||
e.EndsAtUtc,
|
||||
e.ShowId,
|
||||
e.ShowId is { } sid ? showNames.GetValueOrDefault(sid) : null,
|
||||
e.EpisodeIndex
|
||||
e.EpisodeIndex,
|
||||
assetNames.TryGetValue(e.MediaAssetId, out var name) ? EpisodeName.ParseLabel(name) : null
|
||||
))
|
||||
.ToList();
|
||||
|
||||
|
||||
@@ -10,5 +10,6 @@ public sealed record ScheduleEntryDto(
|
||||
DateTimeOffset EndsAtUtc,
|
||||
Guid? ShowId,
|
||||
string? ShowName,
|
||||
int? EpisodeIndex
|
||||
int? EpisodeIndex,
|
||||
string? SeasonEpisode
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user