Refactored ItemValue structure

This commit is contained in:
JPVenson
2024-10-10 14:32:49 +00:00
parent 3e7ce5e1df
commit ee0dad6f43
14 changed files with 1970 additions and 106 deletions

View File

@@ -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; }
}

View File

@@ -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; }

View File

@@ -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
}

View File

@@ -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; }
}