diff --git a/Jellyfin.Data/Entities/BaseItemEntity.cs b/Jellyfin.Data/Entities/BaseItemEntity.cs index 92b5caf057..1b8a6b553b 100644 --- a/Jellyfin.Data/Entities/BaseItemEntity.cs +++ b/Jellyfin.Data/Entities/BaseItemEntity.cs @@ -16,8 +16,6 @@ public class BaseItemEntity public string? Data { get; set; } - public Guid? ParentId { get; set; } - public string? Path { get; set; } public DateTime StartDate { get; set; } @@ -94,8 +92,6 @@ public class BaseItemEntity public string? UnratedType { get; set; } - public Guid? TopParentId { get; set; } - public string? TrailerTypes { get; set; } public float? CriticRating { get; set; } @@ -124,10 +120,6 @@ public class BaseItemEntity public string? SeasonName { get; set; } - public Guid? SeasonId { get; set; } - - public Guid? SeriesId { get; set; } - public string? ExternalSeriesId { get; set; } public string? Tagline { get; set; } @@ -160,6 +152,22 @@ public class BaseItemEntity public long? Size { get; set; } + public Guid? ParentId { get; set; } + + public BaseItemEntity? Parent { get; set; } + + public Guid? TopParentId { get; set; } + + public BaseItemEntity? TopParent { get; set; } + + public Guid? SeasonId { get; set; } + + public BaseItemEntity? Season { get; set; } + + public Guid? SeriesId { get; set; } + + public BaseItemEntity? Series { get; set; } + #pragma warning disable CA2227 // Collection properties should be read only public ICollection? Peoples { get; set; } diff --git a/Jellyfin.Data/Entities/Chapter.cs b/Jellyfin.Data/Entities/Chapter.cs index be353b5da4..a55b7fb538 100644 --- a/Jellyfin.Data/Entities/Chapter.cs +++ b/Jellyfin.Data/Entities/Chapter.cs @@ -8,7 +8,7 @@ namespace Jellyfin.Data.Entities; #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member public class Chapter { - public Guid ItemId { get; set; } + public required Guid ItemId { get; set; } public required BaseItemEntity Item { get; set; } diff --git a/Jellyfin.Data/Entities/ItemValue.cs b/Jellyfin.Data/Entities/ItemValue.cs index 1063aaa8b2..78da478b1c 100644 --- a/Jellyfin.Data/Entities/ItemValue.cs +++ b/Jellyfin.Data/Entities/ItemValue.cs @@ -13,7 +13,7 @@ public class ItemValue /// /// Gets or Sets the reference ItemId. /// - public Guid ItemId { get; set; } + public required Guid ItemId { get; set; } /// /// Gets or Sets the referenced BaseItem. diff --git a/Jellyfin.Data/Entities/MediaStreamInfo.cs b/Jellyfin.Data/Entities/MediaStreamInfo.cs index 992f33ecf8..97b7036b2e 100644 --- a/Jellyfin.Data/Entities/MediaStreamInfo.cs +++ b/Jellyfin.Data/Entities/MediaStreamInfo.cs @@ -5,7 +5,7 @@ namespace Jellyfin.Data.Entities; #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member public class MediaStreamInfo { - public Guid ItemId { get; set; } + public required Guid ItemId { get; set; } public required BaseItemEntity Item { get; set; } diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs index 4aba9d07e1..6f8adb44d9 100644 --- a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs +++ b/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs @@ -13,7 +13,19 @@ public class BaseItemConfiguration : IEntityTypeConfiguration /// public void Configure(EntityTypeBuilder builder) { - builder.HasNoKey(); + builder.HasKey(e => e.Id); + builder.HasOne(e => e.Parent); + builder.HasOne(e => e.TopParent); + builder.HasOne(e => e.Season); + builder.HasOne(e => e.Series); + builder.HasMany(e => e.Peoples); + builder.HasMany(e => e.UserData); + builder.HasMany(e => e.ItemValues); + builder.HasMany(e => e.MediaStreams); + builder.HasMany(e => e.Chapters); + builder.HasMany(e => e.Provider); + builder.HasMany(e => e.AncestorIds); + builder.HasIndex(e => e.Path); builder.HasIndex(e => e.ParentId); builder.HasIndex(e => e.PresentationUniqueKey);