diff options
Diffstat (limited to 'src/Jellyfin.Database/Jellyfin.Database.Implementations')
6 files changed, 22 insertions, 7 deletions
diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/BaseItemImageInfo.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/BaseItemImageInfo.cs index 71d60fc25..cd14764e4 100644 --- a/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/BaseItemImageInfo.cs +++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/BaseItemImageInfo.cs @@ -22,7 +22,7 @@ public class BaseItemImageInfo /// <summary> /// Gets or Sets the time the image was last modified. /// </summary> - public DateTime DateModified { get; set; } + public DateTime? DateModified { get; set; } /// <summary> /// Gets or Sets the imagetype. diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/UserData.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/UserData.cs index cd8068661..3d8b01c2b 100644 --- a/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/UserData.cs +++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/UserData.cs @@ -69,6 +69,11 @@ public class UserData public bool? Likes { get; set; } /// <summary> + /// Gets or Sets the date the referenced <see cref="Item"/> has been deleted. + /// </summary> + public DateTime? RetentionDate { get; set; } + + /// <summary> /// Gets or sets the key. /// </summary> /// <value>The key.</value> diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/IJellyfinDatabaseProvider.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/IJellyfinDatabaseProvider.cs index 6b35810b2..27dbeaba6 100644 --- a/src/Jellyfin.Database/Jellyfin.Database.Implementations/IJellyfinDatabaseProvider.cs +++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/IJellyfinDatabaseProvider.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Jellyfin.Database.Implementations.DbConfiguration; using Microsoft.EntityFrameworkCore; namespace Jellyfin.Database.Implementations; @@ -20,7 +21,8 @@ public interface IJellyfinDatabaseProvider /// Initialises jellyfins EFCore database access. /// </summary> /// <param name="options">The EFCore database options.</param> - void Initialise(DbContextOptionsBuilder options); + /// <param name="databaseConfiguration">The Jellyfin database options.</param> + void Initialise(DbContextOptionsBuilder options, DatabaseConfigurationOptions databaseConfiguration); /// <summary> /// Will be invoked when EFCore wants to build its model. diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/BaseItemConfiguration.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/BaseItemConfiguration.cs index 4a76113bf..bcf458abd 100644 --- a/src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/BaseItemConfiguration.cs +++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/BaseItemConfiguration.cs @@ -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", + }); } } diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/UserDataConfiguration.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/UserDataConfiguration.cs index 47604d321..e7b436293 100644 --- a/src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/UserDataConfiguration.cs +++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/UserDataConfiguration.cs @@ -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); } } diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/QueryPartitionHelpers.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/QueryPartitionHelpers.cs index bb66bddca..c20dfeeb5 100644 --- a/src/Jellyfin.Database/Jellyfin.Database.Implementations/QueryPartitionHelpers.cs +++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/QueryPartitionHelpers.cs @@ -82,7 +82,7 @@ public static class QueryPartitionHelpers /// <typeparam name="TEntity">The entity to load.</typeparam> /// <param name="partitionInfo">The source query.</param> /// <param name="partitionSize">The number of elements to load per partition.</param> - /// <param name="cancellationToken">The cancelation token.</param> + /// <param name="cancellationToken">The cancellation token.</param> /// <returns>A enumerable representing the whole of the query.</returns> public static async IAsyncEnumerable<TEntity> PartitionAsync<TEntity>(this ProgressablePartitionReporting<TEntity> partitionInfo, int partitionSize, [EnumeratorCancellation] CancellationToken cancellationToken = default) { @@ -98,7 +98,7 @@ public static class QueryPartitionHelpers /// <typeparam name="TEntity">The entity to load.</typeparam> /// <param name="partitionInfo">The source query.</param> /// <param name="partitionSize">The number of elements to load per partition.</param> - /// <param name="cancellationToken">The cancelation token.</param> + /// <param name="cancellationToken">The cancellation token.</param> /// <returns>A enumerable representing the whole of the query.</returns> public static async IAsyncEnumerable<TEntity> PartitionEagerAsync<TEntity>(this ProgressablePartitionReporting<TEntity> partitionInfo, int partitionSize, [EnumeratorCancellation] CancellationToken cancellationToken = default) { @@ -115,7 +115,7 @@ public static class QueryPartitionHelpers /// <param name="query">The source query.</param> /// <param name="partitionSize">The number of elements to load per partition.</param> /// <param name="progressablePartition">Reporting helper.</param> - /// <param name="cancellationToken">The cancelation token.</param> + /// <param name="cancellationToken">The cancellation token.</param> /// <returns>A enumerable representing the whole of the query.</returns> public static async IAsyncEnumerable<TEntity> PartitionAsync<TEntity>( this IOrderedQueryable<TEntity> query, @@ -154,7 +154,7 @@ public static class QueryPartitionHelpers /// <param name="query">The source query.</param> /// <param name="partitionSize">The number of elements to load per partition.</param> /// <param name="progressablePartition">Reporting helper.</param> - /// <param name="cancellationToken">The cancelation token.</param> + /// <param name="cancellationToken">The cancellation token.</param> /// <returns>A enumerable representing the whole of the query.</returns> public static async IAsyncEnumerable<TEntity> PartitionEagerAsync<TEntity>( this IOrderedQueryable<TEntity> query, |
