Files
ersatztv/ErsatzTV.Infrastructure/Data/Configurations/ProgramScheduleConfiguration.cs
T
Jason DoveandGitHub 0330b9326d add external json playout type for dizquetv interop (#1539)
* add external json playout

* basic local playback works

* fallback to streaming from plex

* update external json file

* update changelog
2024-01-08 19:45:43 -06:00

33 lines
1.0 KiB
C#

using ErsatzTV.Core.Domain;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace ErsatzTV.Infrastructure.Data.Configurations;
public class ProgramScheduleConfiguration : IEntityTypeConfiguration<ProgramSchedule>
{
public void Configure(EntityTypeBuilder<ProgramSchedule> builder)
{
builder.ToTable("ProgramSchedule");
builder.HasIndex(ps => ps.Name)
.IsUnique();
builder.HasMany(ps => ps.Items)
.WithOne(i => i.ProgramSchedule)
.HasForeignKey(i => i.ProgramScheduleId)
.OnDelete(DeleteBehavior.Cascade)
.IsRequired(false);
builder.HasMany(ps => ps.Playouts)
.WithOne(p => p.ProgramSchedule)
.HasForeignKey(p => p.ProgramScheduleId)
.OnDelete(DeleteBehavior.Cascade);
builder.HasMany(p => p.ProgramScheduleAlternates)
.WithOne(a => a.ProgramSchedule)
.HasForeignKey(a => a.ProgramScheduleId)
.OnDelete(DeleteBehavior.Cascade);
}
}