diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2025-08-03 17:27:17 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-03 17:27:17 -0400 |
| commit | 4b6fb6c4bb2478badad068ce18aabe0c2955db48 (patch) | |
| tree | 15f986ee62327cceb8f5c8f009bcf08d10cfaa66 /Jellyfin.Server.Implementations/ModelConfiguration | |
| parent | e7bc86ebb8496615e0b3f73eb4f13ab4c0913dc8 (diff) | |
| parent | db7465e83d9cc07134a0bffad7ed17b1c7b873da (diff) | |
Merge branch 'master' into master
Diffstat (limited to 'Jellyfin.Server.Implementations/ModelConfiguration')
23 files changed, 0 insertions, 555 deletions
diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/ActivityLogConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/ActivityLogConfiguration.cs deleted file mode 100644 index 9a63ed9f2..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/ActivityLogConfiguration.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// FluentAPI configuration for the ActivityLog entity. -/// </summary> -public class ActivityLogConfiguration : IEntityTypeConfiguration<ActivityLog> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<ActivityLog> builder) - { - builder.HasIndex(entity => entity.DateCreated); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/AncestorIdConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/AncestorIdConfiguration.cs deleted file mode 100644 index 8cc817fb8..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/AncestorIdConfiguration.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// AncestorId configuration. -/// </summary> -public class AncestorIdConfiguration : IEntityTypeConfiguration<AncestorId> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<AncestorId> builder) - { - builder.HasKey(e => new { e.ItemId, e.ParentItemId }); - builder.HasIndex(e => e.ParentItemId); - builder.HasOne(e => e.ParentItem).WithMany(e => e.ParentAncestors).HasForeignKey(f => f.ParentItemId); - builder.HasOne(e => e.Item).WithMany(e => e.Children).HasForeignKey(f => f.ItemId); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/ApiKeyConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/ApiKeyConfiguration.cs deleted file mode 100644 index 3f19b6986..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/ApiKeyConfiguration.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Jellyfin.Data.Entities.Security; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration -{ - /// <summary> - /// FluentAPI configuration for the ApiKey entity. - /// </summary> - public class ApiKeyConfiguration : IEntityTypeConfiguration<ApiKey> - { - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<ApiKey> builder) - { - builder - .HasIndex(entity => entity.AccessToken) - .IsUnique(); - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/AttachmentStreamInfoConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/AttachmentStreamInfoConfiguration.cs deleted file mode 100644 index 057b6689a..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/AttachmentStreamInfoConfiguration.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// FluentAPI configuration for the AttachmentStreamInfo entity. -/// </summary> -public class AttachmentStreamInfoConfiguration : IEntityTypeConfiguration<AttachmentStreamInfo> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<AttachmentStreamInfo> builder) - { - builder.HasKey(e => new { e.ItemId, e.Index }); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs deleted file mode 100644 index eaf48981c..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using SQLitePCL; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// Configuration for BaseItem. -/// </summary> -public class BaseItemConfiguration : IEntityTypeConfiguration<BaseItemEntity> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<BaseItemEntity> builder) - { - builder.HasKey(e => e.Id); - // TODO: See rant in entity file. - // builder.HasOne(e => e.Parent).WithMany(e => e.DirectChildren).HasForeignKey(e => e.ParentId); - // builder.HasOne(e => e.TopParent).WithMany(e => e.AllChildren).HasForeignKey(e => e.TopParentId); - // builder.HasOne(e => e.Season).WithMany(e => e.SeasonEpisodes).HasForeignKey(e => e.SeasonId); - // builder.HasOne(e => e.Series).WithMany(e => e.SeriesEpisodes).HasForeignKey(e => e.SeriesId); - builder.HasMany(e => e.Peoples); - builder.HasMany(e => e.UserData); - builder.HasMany(e => e.ItemValues); - builder.HasMany(e => e.MediaStreams); - builder.HasMany(e => e.Chapters); - builder.HasMany(e => e.Provider); - builder.HasMany(e => e.ParentAncestors); - builder.HasMany(e => e.Children); - builder.HasMany(e => e.LockedFields); - builder.HasMany(e => e.TrailerTypes); - builder.HasMany(e => e.Images); - - builder.HasIndex(e => e.Path); - builder.HasIndex(e => e.ParentId); - builder.HasIndex(e => e.PresentationUniqueKey); - builder.HasIndex(e => new { e.Id, e.Type, e.IsFolder, e.IsVirtualItem }); - - // covering index - builder.HasIndex(e => new { e.TopParentId, e.Id }); - // series - builder.HasIndex(e => new { e.Type, e.SeriesPresentationUniqueKey, e.PresentationUniqueKey, e.SortName }); - // series counts - // seriesdateplayed sort order - builder.HasIndex(e => new { e.Type, e.SeriesPresentationUniqueKey, e.IsFolder, e.IsVirtualItem }); - // live tv programs - builder.HasIndex(e => new { e.Type, e.TopParentId, e.StartDate }); - // covering index for getitemvalues - builder.HasIndex(e => new { e.Type, e.TopParentId, e.Id }); - // used by movie suggestions - builder.HasIndex(e => new { e.Type, e.TopParentId, e.PresentationUniqueKey }); - // latest items - builder.HasIndex(e => new { e.Type, e.TopParentId, e.IsVirtualItem, e.PresentationUniqueKey, e.DateCreated }); - 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 }); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemMetadataFieldConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemMetadataFieldConfiguration.cs deleted file mode 100644 index 137f4a883..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemMetadataFieldConfiguration.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Linq; -using Jellyfin.Data.Entities; -using MediaBrowser.Model.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using SQLitePCL; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// Provides configuration for the BaseItemMetadataField entity. -/// </summary> -public class BaseItemMetadataFieldConfiguration : IEntityTypeConfiguration<BaseItemMetadataField> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<BaseItemMetadataField> builder) - { - builder.HasKey(e => new { e.Id, e.ItemId }); - builder.HasOne(e => e.Item); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemProviderConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemProviderConfiguration.cs deleted file mode 100644 index d15049a1f..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemProviderConfiguration.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// BaseItemProvider configuration. -/// </summary> -public class BaseItemProviderConfiguration : IEntityTypeConfiguration<BaseItemProvider> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<BaseItemProvider> builder) - { - builder.HasKey(e => new { e.ItemId, e.ProviderId }); - builder.HasOne(e => e.Item); - builder.HasIndex(e => new { e.ProviderId, e.ProviderValue, e.ItemId }); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemTrailerTypeConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemTrailerTypeConfiguration.cs deleted file mode 100644 index f03d99c29..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemTrailerTypeConfiguration.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Linq; -using Jellyfin.Data.Entities; -using MediaBrowser.Model.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using SQLitePCL; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// Provides configuration for the BaseItemMetadataField entity. -/// </summary> -public class BaseItemTrailerTypeConfiguration : IEntityTypeConfiguration<BaseItemTrailerType> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<BaseItemTrailerType> builder) - { - builder.HasKey(e => new { e.Id, e.ItemId }); - builder.HasOne(e => e.Item); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/ChapterConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/ChapterConfiguration.cs deleted file mode 100644 index 5a84f7750..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/ChapterConfiguration.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// Chapter configuration. -/// </summary> -public class ChapterConfiguration : IEntityTypeConfiguration<Chapter> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<Chapter> builder) - { - builder.HasKey(e => new { e.ItemId, e.ChapterIndex }); - builder.HasOne(e => e.Item); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/CustomItemDisplayPreferencesConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/CustomItemDisplayPreferencesConfiguration.cs deleted file mode 100644 index 779aec986..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/CustomItemDisplayPreferencesConfiguration.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration -{ - /// <summary> - /// FluentAPI configuration for the CustomItemDisplayPreferences entity. - /// </summary> - public class CustomItemDisplayPreferencesConfiguration : IEntityTypeConfiguration<CustomItemDisplayPreferences> - { - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<CustomItemDisplayPreferences> builder) - { - builder - .HasIndex(entity => new { entity.UserId, entity.ItemId, entity.Client, entity.Key }) - .IsUnique(); - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/DeviceConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/DeviceConfiguration.cs deleted file mode 100644 index a750b65c0..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/DeviceConfiguration.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Jellyfin.Data.Entities.Security; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration -{ - /// <summary> - /// FluentAPI configuration for the Device entity. - /// </summary> - public class DeviceConfiguration : IEntityTypeConfiguration<Device> - { - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<Device> builder) - { - builder - .HasIndex(entity => new { entity.DeviceId, entity.DateLastActivity }); - - builder - .HasIndex(entity => new { entity.AccessToken, entity.DateLastActivity }); - - builder - .HasIndex(entity => new { entity.UserId, entity.DeviceId }); - - builder - .HasIndex(entity => entity.DeviceId); - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/DeviceOptionsConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/DeviceOptionsConfiguration.cs deleted file mode 100644 index 038afd752..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/DeviceOptionsConfiguration.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Jellyfin.Data.Entities.Security; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration -{ - /// <summary> - /// FluentAPI configuration for the DeviceOptions entity. - /// </summary> - public class DeviceOptionsConfiguration : IEntityTypeConfiguration<DeviceOptions> - { - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<DeviceOptions> builder) - { - builder - .HasIndex(entity => entity.DeviceId) - .IsUnique(); - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/DisplayPreferencesConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/DisplayPreferencesConfiguration.cs deleted file mode 100644 index 9b437861b..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/DisplayPreferencesConfiguration.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration -{ - /// <summary> - /// FluentAPI configuration for the DisplayPreferencesConfiguration entity. - /// </summary> - public class DisplayPreferencesConfiguration : IEntityTypeConfiguration<DisplayPreferences> - { - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<DisplayPreferences> builder) - { - builder - .HasMany(d => d.HomeSections) - .WithOne() - .OnDelete(DeleteBehavior.Cascade); - - builder - .HasIndex(entity => new { entity.UserId, entity.ItemId, entity.Client }) - .IsUnique(); - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/ItemValuesConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/ItemValuesConfiguration.cs deleted file mode 100644 index abeeb09c9..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/ItemValuesConfiguration.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// itemvalues Configuration. -/// </summary> -public class ItemValuesConfiguration : IEntityTypeConfiguration<ItemValue> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<ItemValue> builder) - { - builder.HasKey(e => e.ItemValueId); - builder.HasIndex(e => new { e.Type, e.CleanValue }).IsUnique(); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/ItemValuesMapConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/ItemValuesMapConfiguration.cs deleted file mode 100644 index 9c22b114c..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/ItemValuesMapConfiguration.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// itemvalues Configuration. -/// </summary> -public class ItemValuesMapConfiguration : IEntityTypeConfiguration<ItemValueMap> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<ItemValueMap> builder) - { - builder.HasKey(e => new { e.ItemValueId, e.ItemId }); - builder.HasOne(e => e.Item); - builder.HasOne(e => e.ItemValue); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/MediaStreamInfoConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/MediaStreamInfoConfiguration.cs deleted file mode 100644 index 7e572f9a3..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/MediaStreamInfoConfiguration.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// People configuration. -/// </summary> -public class MediaStreamInfoConfiguration : IEntityTypeConfiguration<MediaStreamInfo> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<MediaStreamInfo> builder) - { - builder.HasKey(e => new { e.ItemId, e.StreamIndex }); - builder.HasIndex(e => e.StreamIndex); - builder.HasIndex(e => e.StreamType); - builder.HasIndex(e => new { e.StreamIndex, e.StreamType }); - builder.HasIndex(e => new { e.StreamIndex, e.StreamType, e.Language }); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/PeopleBaseItemMapConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/PeopleBaseItemMapConfiguration.cs deleted file mode 100644 index cdaee9161..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/PeopleBaseItemMapConfiguration.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// People configuration. -/// </summary> -public class PeopleBaseItemMapConfiguration : IEntityTypeConfiguration<PeopleBaseItemMap> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<PeopleBaseItemMap> builder) - { - builder.HasKey(e => new { e.ItemId, e.PeopleId }); - builder.HasIndex(e => new { e.ItemId, e.SortOrder }); - builder.HasIndex(e => new { e.ItemId, e.ListOrder }); - builder.HasOne(e => e.Item); - builder.HasOne(e => e.People); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/PeopleConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/PeopleConfiguration.cs deleted file mode 100644 index f3cccb13f..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/PeopleConfiguration.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// People configuration. -/// </summary> -public class PeopleConfiguration : IEntityTypeConfiguration<People> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<People> builder) - { - builder.HasKey(e => e.Id); - builder.HasIndex(e => e.Name); - builder.HasMany(e => e.BaseItems); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/PermissionConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/PermissionConfiguration.cs deleted file mode 100644 index 240e284c0..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/PermissionConfiguration.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration -{ - /// <summary> - /// FluentAPI configuration for the Permission entity. - /// </summary> - public class PermissionConfiguration : IEntityTypeConfiguration<Permission> - { - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<Permission> builder) - { - // Used to get a user's permissions or a specific permission for a user. - // Also prevents multiple values being created for a user. - // Filtered over non-null user ids for when other entities (groups, API keys) get permissions - builder - .HasIndex(p => new { p.UserId, p.Kind }) - .HasFilter("[UserId] IS NOT NULL") - .IsUnique(); - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/PreferenceConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/PreferenceConfiguration.cs deleted file mode 100644 index 49c869c6a..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/PreferenceConfiguration.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration -{ - /// <summary> - /// FluentAPI configuration for the Permission entity. - /// </summary> - public class PreferenceConfiguration : IEntityTypeConfiguration<Preference> - { - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<Preference> builder) - { - builder - .HasIndex(p => new { p.UserId, p.Kind }) - .HasFilter("[UserId] IS NOT NULL") - .IsUnique(); - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/TrickplayInfoConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/TrickplayInfoConfiguration.cs deleted file mode 100644 index dc1c17e5e..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/TrickplayInfoConfiguration.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration -{ - /// <summary> - /// FluentAPI configuration for the TrickplayInfo entity. - /// </summary> - public class TrickplayInfoConfiguration : IEntityTypeConfiguration<TrickplayInfo> - { - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<TrickplayInfo> builder) - { - builder.HasKey(info => new { info.ItemId, info.Width }); - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/UserConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/UserConfiguration.cs deleted file mode 100644 index a369cf656..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/UserConfiguration.cs +++ /dev/null @@ -1,56 +0,0 @@ -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration -{ - /// <summary> - /// FluentAPI configuration for the User entity. - /// </summary> - public class UserConfiguration : IEntityTypeConfiguration<User> - { - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<User> builder) - { - builder - .Property(user => user.Username) - .UseCollation("NOCASE"); - - builder - .HasOne(u => u.ProfileImage) - .WithOne() - .OnDelete(DeleteBehavior.Cascade); - - builder - .HasMany(u => u.Permissions) - .WithOne() - .HasForeignKey(p => p.UserId) - .OnDelete(DeleteBehavior.Cascade); - - builder - .HasMany(u => u.Preferences) - .WithOne() - .HasForeignKey(p => p.UserId) - .OnDelete(DeleteBehavior.Cascade); - - builder - .HasMany(u => u.AccessSchedules) - .WithOne() - .OnDelete(DeleteBehavior.Cascade); - - builder - .HasMany(u => u.DisplayPreferences) - .WithOne() - .OnDelete(DeleteBehavior.Cascade); - - builder - .HasMany(u => u.ItemDisplayPreferences) - .WithOne() - .OnDelete(DeleteBehavior.Cascade); - - builder - .HasIndex(entity => entity.Username) - .IsUnique(); - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/UserDataConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/UserDataConfiguration.cs deleted file mode 100644 index 7bbb28d43..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/UserDataConfiguration.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// FluentAPI configuration for the UserData entity. -/// </summary> -public class UserDataConfiguration : IEntityTypeConfiguration<UserData> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<UserData> builder) - { - builder.HasKey(d => new { d.ItemId, d.UserId, d.CustomDataKey }); - builder.HasIndex(d => new { d.ItemId, d.UserId, d.Played }); - 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); - } -} |
