Feature/persistent watch data (#14262)

This commit is contained in:
JPVenson
2025-06-10 02:14:27 +03:00
committed by GitHub
parent 3554f068fb
commit d3ad2aec60
10 changed files with 1875 additions and 3 deletions

View File

@@ -68,6 +68,11 @@ public class UserData
/// <value><c>null</c> if [likes] contains no value, <c>true</c> if [likes]; otherwise, <c>false</c>.</value>
public bool? Likes { get; set; }
/// <summary>
/// Gets or Sets the date the referenced <see cref="Item"/> has been deleted.
/// </summary>
public DateTimeOffset? RetentionDate { get; set; }
/// <summary>
/// Gets or sets the key.
/// </summary>

View File

@@ -1,3 +1,4 @@
using System;
using Jellyfin.Database.Implementations.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
@@ -53,5 +54,12 @@ public class BaseItemConfiguration : IEntityTypeConfiguration<BaseItemEntity>
builder.HasIndex(e => new { e.IsFolder, e.TopParentId, e.IsVirtualItem, e.PresentationUniqueKey, e.DateCreated });
// resume
builder.HasIndex(e => new { e.MediaType, e.TopParentId, e.IsVirtualItem, e.PresentationUniqueKey });
builder.HasData(new BaseItemEntity()
{
Id = Guid.Parse("00000000-0000-0000-0000-000000000001"),
Type = "PLACEHOLDER",
Name = "This is a placeholder item for UserData that has been detacted from its original item",
});
}
}

View File

@@ -17,6 +17,6 @@ public class UserDataConfiguration : IEntityTypeConfiguration<UserData>
builder.HasIndex(d => new { d.ItemId, d.UserId, d.PlaybackPositionTicks });
builder.HasIndex(d => new { d.ItemId, d.UserId, d.IsFavorite });
builder.HasIndex(d => new { d.ItemId, d.UserId, d.LastPlayedDate });
builder.HasOne(e => e.Item);
builder.HasOne(e => e.Item).WithMany(e => e.UserData);
}
}