* sort block tree views * fix naming validation for block scheduling * show deco group name in deco editor * show block group name in block editor * show template group name in template editor * show deco template group name in deco template editor * fix template rename crash * fix block rename crash * fix deco template rename crash
27 lines
829 B
C#
27 lines
829 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(d => new { d.TemplateGroupId, d.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);
|
|
}
|
|
}
|