From ee0dad6f432e5bfdda074e3f006f4c4d3c418d08 Mon Sep 17 00:00:00 2001 From: JPVenson Date: Thu, 10 Oct 2024 14:32:49 +0000 Subject: Refactored ItemValue structure --- Jellyfin.Data/Entities/AncestorId.cs | 14 ++++++++++++-- Jellyfin.Data/Entities/BaseItemEntity.cs | 2 +- Jellyfin.Data/Entities/ItemValue.cs | 18 +++++++++--------- Jellyfin.Data/Entities/ItemValueMap.cs | 30 ++++++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 12 deletions(-) create mode 100644 Jellyfin.Data/Entities/ItemValueMap.cs (limited to 'Jellyfin.Data') diff --git a/Jellyfin.Data/Entities/AncestorId.cs b/Jellyfin.Data/Entities/AncestorId.cs index 941a8eb2e..ef0fe0ba7 100644 --- a/Jellyfin.Data/Entities/AncestorId.cs +++ b/Jellyfin.Data/Entities/AncestorId.cs @@ -8,12 +8,22 @@ namespace Jellyfin.Data.Entities; public class AncestorId { /// - /// Gets or Sets the AncestorId that may or may not be an database managed Item or an materialised local item. + /// Gets or Sets the AncestorId. /// public required Guid ParentItemId { get; set; } /// - /// Gets or Sets the related that may or may not be an database managed Item or an materialised local item. + /// Gets or Sets the related BaseItem. /// public required Guid ItemId { get; set; } + + /// + /// Gets or Sets the ParentItem. + /// + public required BaseItemEntity ParentItem { get; set; } + + /// + /// Gets or Sets the Child item. + /// + public required BaseItemEntity Item { get; set; } } diff --git a/Jellyfin.Data/Entities/BaseItemEntity.cs b/Jellyfin.Data/Entities/BaseItemEntity.cs index cd1991891..7670c1893 100644 --- a/Jellyfin.Data/Entities/BaseItemEntity.cs +++ b/Jellyfin.Data/Entities/BaseItemEntity.cs @@ -158,7 +158,7 @@ public class BaseItemEntity public ICollection? UserData { get; set; } - public ICollection? ItemValues { get; set; } + public ICollection? ItemValues { get; set; } public ICollection? MediaStreams { get; set; } diff --git a/Jellyfin.Data/Entities/ItemValue.cs b/Jellyfin.Data/Entities/ItemValue.cs index bfa53cd46..7b1048c10 100644 --- a/Jellyfin.Data/Entities/ItemValue.cs +++ b/Jellyfin.Data/Entities/ItemValue.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; namespace Jellyfin.Data.Entities; @@ -11,14 +9,9 @@ namespace Jellyfin.Data.Entities; public class ItemValue { /// - /// Gets or Sets the reference ItemId. + /// Gets or Sets the ItemValueId. /// - public required Guid ItemId { get; set; } - - /// - /// Gets or Sets the referenced BaseItem. - /// - public required BaseItemEntity Item { get; set; } + public required Guid ItemValueId { get; set; } /// /// Gets or Sets the Type. @@ -34,4 +27,11 @@ public class ItemValue /// Gets or Sets the sanatised Value. /// public required string CleanValue { get; set; } + + /// + /// Gets or Sets all associated BaseItems. + /// +#pragma warning disable CA2227 // Collection properties should be read only + public ICollection? BaseItemsMap { get; set; } +#pragma warning restore CA2227 // Collection properties should be read only } diff --git a/Jellyfin.Data/Entities/ItemValueMap.cs b/Jellyfin.Data/Entities/ItemValueMap.cs new file mode 100644 index 000000000..94db6a011 --- /dev/null +++ b/Jellyfin.Data/Entities/ItemValueMap.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; + +namespace Jellyfin.Data.Entities; + +/// +/// Mapping table for the ItemValue BaseItem relation. +/// +public class ItemValueMap +{ + /// + /// Gets or Sets the ItemId. + /// + public required Guid ItemId { get; set; } + + /// + /// Gets or Sets the ItemValueId. + /// + public required Guid ItemValueId { get; set; } + + /// + /// Gets or Sets the referenced . + /// + public required BaseItemEntity Item { get; set; } + + /// + /// Gets or Sets the referenced . + /// + public required ItemValue ItemValue { get; set; } +} -- cgit v1.2.3