aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Data
diff options
context:
space:
mode:
authorJPVenson <github@jpb.email>2024-10-10 14:32:49 +0000
committerJPVenson <github@jpb.email>2024-10-10 14:32:49 +0000
commitee0dad6f432e5bfdda074e3f006f4c4d3c418d08 (patch)
tree34bbc0ea11007d9e7cd84f738d7b69cf88073259 /Jellyfin.Data
parent3e7ce5e1df9c6820a6dfd4c23aea29eed83b43ba (diff)
Refactored ItemValue structure
Diffstat (limited to 'Jellyfin.Data')
-rw-r--r--Jellyfin.Data/Entities/AncestorId.cs14
-rw-r--r--Jellyfin.Data/Entities/BaseItemEntity.cs2
-rw-r--r--Jellyfin.Data/Entities/ItemValue.cs18
-rw-r--r--Jellyfin.Data/Entities/ItemValueMap.cs30
4 files changed, 52 insertions, 12 deletions
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
{
/// <summary>
- /// 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.
/// </summary>
public required Guid ParentItemId { get; set; }
/// <summary>
- /// 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.
/// </summary>
public required Guid ItemId { get; set; }
+
+ /// <summary>
+ /// Gets or Sets the ParentItem.
+ /// </summary>
+ public required BaseItemEntity ParentItem { get; set; }
+
+ /// <summary>
+ /// Gets or Sets the Child item.
+ /// </summary>
+ 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>? UserData { get; set; }
- public ICollection<ItemValue>? ItemValues { get; set; }
+ public ICollection<ItemValueMap>? ItemValues { get; set; }
public ICollection<MediaStreamInfo>? 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
{
/// <summary>
- /// Gets or Sets the reference ItemId.
+ /// Gets or Sets the ItemValueId.
/// </summary>
- public required Guid ItemId { get; set; }
-
- /// <summary>
- /// Gets or Sets the referenced BaseItem.
- /// </summary>
- public required BaseItemEntity Item { get; set; }
+ public required Guid ItemValueId { get; set; }
/// <summary>
/// Gets or Sets the Type.
@@ -34,4 +27,11 @@ public class ItemValue
/// Gets or Sets the sanatised Value.
/// </summary>
public required string CleanValue { get; set; }
+
+ /// <summary>
+ /// Gets or Sets all associated BaseItems.
+ /// </summary>
+#pragma warning disable CA2227 // Collection properties should be read only
+ public ICollection<ItemValueMap>? 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;
+
+/// <summary>
+/// Mapping table for the ItemValue BaseItem relation.
+/// </summary>
+public class ItemValueMap
+{
+ /// <summary>
+ /// Gets or Sets the ItemId.
+ /// </summary>
+ public required Guid ItemId { get; set; }
+
+ /// <summary>
+ /// Gets or Sets the ItemValueId.
+ /// </summary>
+ public required Guid ItemValueId { get; set; }
+
+ /// <summary>
+ /// Gets or Sets the referenced <see cref="BaseItemEntity"/>.
+ /// </summary>
+ public required BaseItemEntity Item { get; set; }
+
+ /// <summary>
+ /// Gets or Sets the referenced <see cref="ItemValue"/>.
+ /// </summary>
+ public required ItemValue ItemValue { get; set; }
+}