Add broadcast scheduling features: implement Show and Channel entities, enhance AppDbContext and DependencyInjection for broadcasting, and update API routing. Include migration for new database schema and update documentation for broadcast-related functionalities.
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
namespace TeleWave.Domain.Broadcast;
|
||||
|
||||
/// <summary>
|
||||
/// Материализованная запись расписания канала: конкретный ассет в конкретное время. Программы и
|
||||
/// реклама идут встык (<see cref="EndsAtUtc"/> одной равен <see cref="StartsAtUtc"/> следующей).
|
||||
/// </summary>
|
||||
public class ScheduleEntry
|
||||
{
|
||||
public Guid Id { get; private set; }
|
||||
public Guid ChannelId { get; private set; }
|
||||
public Guid MediaAssetId { get; private set; }
|
||||
public ScheduleEntryKind Kind { get; private set; }
|
||||
public DateTimeOffset StartsAtUtc { get; private set; }
|
||||
public DateTimeOffset EndsAtUtc { get; private set; }
|
||||
|
||||
/// <summary>Шоу (для <see cref="ScheduleEntryKind.Program"/>) — для EPG.</summary>
|
||||
public Guid? ShowId { get; private set; }
|
||||
|
||||
/// <summary>Индекс серии в упорядоченном списке шоу (для EPG).</summary>
|
||||
public int? EpisodeIndex { get; private set; }
|
||||
|
||||
private ScheduleEntry() { }
|
||||
|
||||
public static ScheduleEntry Program(
|
||||
Guid channelId,
|
||||
Guid mediaAssetId,
|
||||
DateTimeOffset startsAtUtc,
|
||||
DateTimeOffset endsAtUtc,
|
||||
Guid showId,
|
||||
int episodeIndex
|
||||
) =>
|
||||
new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
ChannelId = channelId,
|
||||
MediaAssetId = mediaAssetId,
|
||||
Kind = ScheduleEntryKind.Program,
|
||||
StartsAtUtc = startsAtUtc,
|
||||
EndsAtUtc = endsAtUtc,
|
||||
ShowId = showId,
|
||||
EpisodeIndex = episodeIndex,
|
||||
};
|
||||
|
||||
public static ScheduleEntry Ad(
|
||||
Guid channelId,
|
||||
Guid mediaAssetId,
|
||||
DateTimeOffset startsAtUtc,
|
||||
DateTimeOffset endsAtUtc
|
||||
) =>
|
||||
new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
ChannelId = channelId,
|
||||
MediaAssetId = mediaAssetId,
|
||||
Kind = ScheduleEntryKind.Ad,
|
||||
StartsAtUtc = startsAtUtc,
|
||||
EndsAtUtc = endsAtUtc,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user