Files
ersatztv/ErsatzTV.Infrastructure/Data/Configurations/Scheduling/TemplateConfiguration.cs
T
Jason DoveandGitHub dcbe4837bf first pass at block scheduling (#1548)
* add blocks, block groups

* basic block and block item editing

* add template groups and basic template editing (name)

* add blocks to template calendar

* edit playout templates

* add calendar preview to playout templates

* add basic block playout building

* add mysql migration

* update changelog
2024-01-13 22:01:21 -06:00

27 lines
802 B
C#

using ErsatzTV.Core.Domain.Scheduling;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace ErsatzTV.Infrastructure.Data.Configurations.Scheduling;
public class TemplateConfiguration : IEntityTypeConfiguration<Template>
{
public void Configure(EntityTypeBuilder<Template> builder)
{
builder.ToTable("Template");
builder.HasIndex(b => b.Name)
.IsUnique();
builder.HasMany(b => b.Items)
.WithOne(i => i.Template)
.HasForeignKey(i => i.TemplateId)
.OnDelete(DeleteBehavior.Cascade);
builder.HasMany(t => t.PlayoutTemplates)
.WithOne(t => t.Template)
.HasForeignKey(t => t.TemplateId)
.OnDelete(DeleteBehavior.Cascade);
}
}