* add explicit warning for zero/invalid duration media items * set dateadded on plex media versions * add media stream table * save local media streams to db * save plex media streams to db * add preferred language settings (no validation) * use preferred language if possible * code cleanup * proper language code validation * force scan of all libraries to pull in media streams
25 lines
809 B
C#
25 lines
809 B
C#
using ErsatzTV.Core.Domain;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace ErsatzTV.Infrastructure.Data.Configurations
|
|
{
|
|
public class MediaVersionConfiguration : IEntityTypeConfiguration<MediaVersion>
|
|
{
|
|
public void Configure(EntityTypeBuilder<MediaVersion> builder)
|
|
{
|
|
builder.ToTable("MediaVersion");
|
|
|
|
builder.HasMany(v => v.MediaFiles)
|
|
.WithOne(f => f.MediaVersion)
|
|
.HasForeignKey(f => f.MediaVersionId)
|
|
.OnDelete(DeleteBehavior.Cascade);
|
|
|
|
builder.HasMany(v => v.Streams)
|
|
.WithOne(s => s.MediaVersion)
|
|
.HasForeignKey(s => s.MediaVersionId)
|
|
.OnDelete(DeleteBehavior.Cascade);
|
|
}
|
|
}
|
|
}
|