Files
ersatztv/ErsatzTV.Infrastructure/Data/Configurations/ChannelTemplateConfiguration.cs
T
timothy 7858ac002a
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 5m34s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 5m58s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
feat(api): add channel templates
2026-07-06 18:43:39 +02:00

63 lines
1.9 KiB
C#

using ErsatzTV.Core.Domain;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace ErsatzTV.Infrastructure.Data.Configurations;
public class ChannelTemplateConfiguration : IEntityTypeConfiguration<ChannelTemplate>
{
public void Configure(EntityTypeBuilder<ChannelTemplate> builder)
{
builder.ToTable("ChannelTemplate");
builder.HasIndex(t => t.Name)
.IsUnique();
builder.Property(t => t.Name)
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.IsRequired();
builder.Property(t => t.Description)
.HasMaxLength(500)
.HasColumnType("varchar(500)")
.HasDefaultValue(string.Empty)
.IsRequired();
builder.HasOne(t => t.FFmpegProfile)
.WithMany()
.HasForeignKey(t => t.FFmpegProfileId)
.OnDelete(DeleteBehavior.Restrict);
builder.HasOne(t => t.Watermark)
.WithMany()
.HasForeignKey(t => t.WatermarkId)
.OnDelete(DeleteBehavior.SetNull)
.IsRequired(false);
builder.HasOne(t => t.FallbackFiller)
.WithMany()
.HasForeignKey(t => t.FallbackFillerId)
.OnDelete(DeleteBehavior.SetNull)
.IsRequired(false);
builder.HasOne(t => t.PreRollFiller)
.WithMany()
.HasForeignKey(t => t.PreRollFillerId)
.OnDelete(DeleteBehavior.SetNull)
.IsRequired(false);
builder.HasOne(t => t.MidRollFiller)
.WithMany()
.HasForeignKey(t => t.MidRollFillerId)
.OnDelete(DeleteBehavior.SetNull)
.IsRequired(false);
builder.HasOne(t => t.PostRollFiller)
.WithMany()
.HasForeignKey(t => t.PostRollFillerId)
.OnDelete(DeleteBehavior.SetNull)
.IsRequired(false);
}
}