Add TV bumpers functionality: introduce configuration options for bumpers in .env.example and appsettings.json, enhance ChannelEndpoints to manage jingles and bumper assets, and update Channel and ScheduleEntry models to support bumper logic. Implement validation for bumper settings and integrate bumper handling in scheduling logic.
This commit is contained in:
@@ -23,6 +23,7 @@ public class AppDbContext(DbContextOptions<AppDbContext> options)
|
||||
public DbSet<Show> Shows => Set<Show>();
|
||||
public DbSet<Channel> Channels => Set<Channel>();
|
||||
public DbSet<ScheduleEntry> ScheduleEntries => Set<ScheduleEntry>();
|
||||
public DbSet<BumperAsset> BumperAssets => Set<BumperAsset>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using TeleWave.Domain.Broadcast;
|
||||
|
||||
namespace TeleWave.Infrastructure.Persistence.Configurations;
|
||||
|
||||
public class BumperAssetConfiguration : IEntityTypeConfiguration<BumperAsset>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<BumperAsset> builder)
|
||||
{
|
||||
builder.Property(x => x.Signature).IsRequired().HasMaxLength(128);
|
||||
|
||||
// Кэш-ключ заставки: одна отрендеренная пара «из→в» при данной сигнатуре оформления.
|
||||
builder.HasIndex(x => new
|
||||
{
|
||||
x.FromShowId,
|
||||
x.ToShowId,
|
||||
x.Signature,
|
||||
});
|
||||
}
|
||||
}
|
||||
+15
@@ -27,6 +27,13 @@ public class ChannelConfiguration : IEntityTypeConfiguration<Channel>
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
builder.Navigation(x => x.Ads).UsePropertyAccessMode(PropertyAccessMode.Field);
|
||||
|
||||
builder
|
||||
.HasMany(x => x.Jingles)
|
||||
.WithOne()
|
||||
.HasForeignKey(j => j.ChannelId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
builder.Navigation(x => x.Jingles).UsePropertyAccessMode(PropertyAccessMode.Field);
|
||||
|
||||
builder
|
||||
.HasMany(x => x.Overrides)
|
||||
.WithOne()
|
||||
@@ -52,6 +59,14 @@ public class ChannelAdConfiguration : IEntityTypeConfiguration<ChannelAd>
|
||||
}
|
||||
}
|
||||
|
||||
public class ChannelJingleConfiguration : IEntityTypeConfiguration<ChannelJingle>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<ChannelJingle> builder)
|
||||
{
|
||||
builder.HasIndex(x => new { x.ChannelId, x.Position });
|
||||
}
|
||||
}
|
||||
|
||||
public class ProgrammingOverrideConfiguration : IEntityTypeConfiguration<ProgrammingOverride>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<ProgrammingOverride> builder)
|
||||
|
||||
Reference in New Issue
Block a user