diff --git a/src/Lumina.Application/Common/DataAccess/Entities/UsersManagement/UserSettingsEntity.cs b/src/Lumina.Application/Common/DataAccess/Entities/UsersManagement/UserSettingsEntity.cs index 768de9e8..524544bb 100644 --- a/src/Lumina.Application/Common/DataAccess/Entities/UsersManagement/UserSettingsEntity.cs +++ b/src/Lumina.Application/Common/DataAccess/Entities/UsersManagement/UserSettingsEntity.cs @@ -37,6 +37,11 @@ public class UserSettingsEntity : IStorageEntity, IAuditableEntity /// public bool IgnoreThePrefixForAlphaPicker { get; set; } + /// + /// Gets or sets whether the theme data served to this user is cached, or not. + /// + public bool IsThemeCachingEnabled { get; set; } = true; + /// /// Gets or sets the time and date when the entity was added. /// diff --git a/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UpdateUserSettingsRequestMapping.cs b/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UpdateUserSettingsRequestMapping.cs index 8eee0bcb..23504a3c 100644 --- a/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UpdateUserSettingsRequestMapping.cs +++ b/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UpdateUserSettingsRequestMapping.cs @@ -20,6 +20,7 @@ public static class UpdateUserSettingsRequestMapping return new UpdateUserSettingsCommand( request.IsPaginationEnabled, request.ItemsPerPage, - request.IgnoreThePrefixForAlphaPicker); + request.IgnoreThePrefixForAlphaPicker, + request.IsThemeCachingEnabled); } } diff --git a/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UserSettingsEntityMapping.cs b/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UserSettingsEntityMapping.cs index a109efca..b96f8fdb 100644 --- a/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UserSettingsEntityMapping.cs +++ b/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UserSettingsEntityMapping.cs @@ -28,7 +28,8 @@ public static class UserSettingsEntityMapping UserId.Create(repositoryEntity.UserId), repositoryEntity.IsPaginationEnabled, repositoryEntity.ItemsPerPage, - repositoryEntity.IgnoreThePrefixForAlphaPicker); + repositoryEntity.IgnoreThePrefixForAlphaPicker, + repositoryEntity.IsThemeCachingEnabled); } /// @@ -42,6 +43,7 @@ public static class UserSettingsEntityMapping repositoryEntity.UserId, repositoryEntity.IsPaginationEnabled, repositoryEntity.ItemsPerPage, - repositoryEntity.IgnoreThePrefixForAlphaPicker); + repositoryEntity.IgnoreThePrefixForAlphaPicker, + repositoryEntity.IsThemeCachingEnabled); } } diff --git a/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UserSettingsMapping.cs b/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UserSettingsMapping.cs index 45764c56..7a22ee1e 100644 --- a/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UserSettingsMapping.cs +++ b/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UserSettingsMapping.cs @@ -24,7 +24,8 @@ public static class UserSettingsMapping UserId = domainEntity.UserId.Value, IsPaginationEnabled = domainEntity.IsPaginationEnabled, ItemsPerPage = domainEntity.ItemsPerPage, - IgnoreThePrefixForAlphaPicker = domainEntity.IgnoreThePrefixForAlphaPicker + IgnoreThePrefixForAlphaPicker = domainEntity.IgnoreThePrefixForAlphaPicker, + IsThemeCachingEnabled = domainEntity.IsThemeCachingEnabled }; } @@ -39,6 +40,7 @@ public static class UserSettingsMapping domainEntity.UserId.Value, domainEntity.IsPaginationEnabled, domainEntity.ItemsPerPage, - domainEntity.IgnoreThePrefixForAlphaPicker); + domainEntity.IgnoreThePrefixForAlphaPicker, + domainEntity.IsThemeCachingEnabled); } } diff --git a/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommand.cs b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommand.cs index a7f081cf..0e798ccc 100644 --- a/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommand.cs +++ b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommand.cs @@ -10,8 +10,10 @@ namespace Lumina.Application.Core.UsersManagement.Settings.Commands.UpdateUserSe /// Whether pagination is enabled for the user, or not. /// The number of library items displayed per page when pagination is enabled. /// Whether the "The" prefix of library item titles is ignored by the alpha picker, or not. +/// Whether the theme data served to this user is cached, or not. public record UpdateUserSettingsCommand( bool IsPaginationEnabled, int ItemsPerPage, - bool IgnoreThePrefixForAlphaPicker + bool IgnoreThePrefixForAlphaPicker, + bool IsThemeCachingEnabled ) : ICommand; diff --git a/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandHandler.cs b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandHandler.cs index 4070ab3a..3028518b 100644 --- a/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandHandler.cs +++ b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandHandler.cs @@ -72,7 +72,8 @@ public class UpdateUserSettingsCommandHandler : ICommandHandler updateSettingsResult = toDomainEntityResult.Value.UpdateSettings( command.IsPaginationEnabled, command.ItemsPerPage, - command.IgnoreThePrefixForAlphaPicker); + command.IgnoreThePrefixForAlphaPicker, + command.IsThemeCachingEnabled); if (updateSettingsResult.IsFailure) return updateSettingsResult.Errors; diff --git a/src/Lumina.Contracts/Requests/UsersManagement/Settings/UpdateUserSettingsRequest.cs b/src/Lumina.Contracts/Requests/UsersManagement/Settings/UpdateUserSettingsRequest.cs index eb76b7ad..2b0ad237 100644 --- a/src/Lumina.Contracts/Requests/UsersManagement/Settings/UpdateUserSettingsRequest.cs +++ b/src/Lumina.Contracts/Requests/UsersManagement/Settings/UpdateUserSettingsRequest.cs @@ -10,9 +10,11 @@ namespace Lumina.Contracts.Requests.UsersManagement.Settings; /// Whether pagination is enabled for the user, or not. Required. /// The number of library items displayed per page when pagination is enabled. Required. /// Whether the "The" prefix of library item titles is ignored by the alpha picker, or not. Required. +/// Whether the theme data served to this user is cached, or not. Required. [DebuggerDisplay("IsPaginationEnabled: {IsPaginationEnabled}; ItemsPerPage: {ItemsPerPage}")] public sealed record UpdateUserSettingsRequest( bool IsPaginationEnabled, int ItemsPerPage, - bool IgnoreThePrefixForAlphaPicker + bool IgnoreThePrefixForAlphaPicker, + bool IsThemeCachingEnabled ); diff --git a/src/Lumina.Contracts/Responses/UsersManagement/Settings/UserSettingsResponse.cs b/src/Lumina.Contracts/Responses/UsersManagement/Settings/UserSettingsResponse.cs index 2e29dd70..3c362b34 100644 --- a/src/Lumina.Contracts/Responses/UsersManagement/Settings/UserSettingsResponse.cs +++ b/src/Lumina.Contracts/Responses/UsersManagement/Settings/UserSettingsResponse.cs @@ -12,10 +12,12 @@ namespace Lumina.Contracts.Responses.UsersManagement.Settings; /// Whether pagination is enabled for the user, or not. /// The number of library items displayed per page when pagination is enabled. /// Whether the "The" prefix of library item titles is ignored by the alpha picker, or not. +/// Whether the theme data served to this user is cached, or not. [DebuggerDisplay("UserId: {UserId}")] public sealed record UserSettingsResponse( Guid UserId, bool IsPaginationEnabled, int ItemsPerPage, - bool IgnoreThePrefixForAlphaPicker + bool IgnoreThePrefixForAlphaPicker, + bool IsThemeCachingEnabled ); diff --git a/src/Lumina.DataAccess/Common/Configuration/UserSettingsConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/UserSettingsConfiguration.cs index a24022a1..ca160a72 100644 --- a/src/Lumina.DataAccess/Common/Configuration/UserSettingsConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/UserSettingsConfiguration.cs @@ -47,6 +47,10 @@ public class UserSettingsConfiguration : IEntityTypeConfiguration settings.IsThemeCachingEnabled) + .IsRequired() + .HasColumnOrder(9); + // audit builder.Property(settings => settings.CreatedOnUtc) .IsRequired() diff --git a/src/Lumina.DataAccess/Common/Migrations/20260821092546_AddsIsThemeCachingEnabledToUserSettings.Designer.cs b/src/Lumina.DataAccess/Common/Migrations/20260821092546_AddsIsThemeCachingEnabledToUserSettings.Designer.cs new file mode 100644 index 00000000..5f59be74 --- /dev/null +++ b/src/Lumina.DataAccess/Common/Migrations/20260821092546_AddsIsThemeCachingEnabledToUserSettings.Designer.cs @@ -0,0 +1,1306 @@ +// +using System; +using Lumina.DataAccess.Core.UoW; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Lumina.DataAccess.Common.Migrations +{ + [DbContext(typeof(LuminaDbContext))] + [Migration("20260821092546_AddsIsThemeCachingEnabledToUserSettings")] + partial class AddsIsThemeCachingEnabledToUserSettings + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "10.0.11"); + + modelBuilder.Entity("BookGenres", b => + { + b.Property("BookId") + .HasColumnType("TEXT"); + + b.Property("GenreId") + .HasColumnType("TEXT"); + + b.HasKey("BookId", "GenreId"); + + b.HasIndex("GenreId"); + + b.ToTable("BookGenres", (string)null); + }); + + modelBuilder.Entity("BookTags", b => + { + b.Property("BookId") + .HasColumnType("TEXT"); + + b.Property("TagId") + .HasColumnType("TEXT"); + + b.HasKey("BookId", "TagId"); + + b.HasIndex("TagId"); + + b.ToTable("BookTags", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.PermissionEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(3); + + b.Property("PermissionName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.HasKey("Id"); + + b.ToTable("Permissions", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.RoleEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(3); + + b.Property("RoleName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.HasKey("Id"); + + b.ToTable("Roles", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.RolePermissionEntity", b => + { + b.Property("RoleId") + .HasColumnType("TEXT"); + + b.Property("PermissionId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(3); + + b.HasKey("RoleId", "PermissionId"); + + b.HasIndex("PermissionId"); + + b.HasIndex("RoleId", "PermissionId") + .IsUnique(); + + b.ToTable("RolePermissions", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.UserPermissionEntity", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("PermissionId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(3); + + b.HasKey("UserId", "PermissionId"); + + b.HasIndex("PermissionId"); + + b.HasIndex("UserId", "PermissionId") + .IsUnique(); + + b.ToTable("UserPermissions", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.UserRoleEntity", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("RoleId") + .HasColumnType("TEXT"); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(3); + + b.HasKey("UserId"); + + b.HasIndex("RoleId"); + + b.HasIndex("UserId", "RoleId") + .IsUnique(); + + b.ToTable("UserRoles", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Common.GenreEntity", b => + { + b.Property("Name") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Name"); + + b.ToTable("Genres", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Common.TagEntity", b => + { + b.Property("Name") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Name"); + + b.ToTable("Tags", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.DirectoryScanFingerprintEntity", b => + { + b.Property("LibraryId") + .HasColumnType("TEXT"); + + b.Property("Path") + .HasMaxLength(1024) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("LastWriteTimeUtc") + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.HasKey("LibraryId", "Path"); + + b.HasIndex("LibraryId"); + + b.ToTable("DirectoryScanFingerprints", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("CoverImage") + .HasMaxLength(255) + .HasColumnType("TEXT") + .HasColumnOrder(3); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(10); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(9); + + b.Property("DownloadMetadataFromWeb") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(true) + .HasColumnOrder(6); + + b.Property("IsEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(true) + .HasColumnOrder(4); + + b.Property("IsLocked") + .HasColumnType("INTEGER") + .HasColumnOrder(5); + + b.Property("LibraryType") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("ShouldSaveMetadataInMediaDirectories") + .HasColumnType("INTEGER") + .HasColumnOrder(7); + + b.Property("ShouldSkipUnchangedDirectoriesDuringScan") + .HasColumnType("INTEGER") + .HasColumnOrder(8); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(12); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(11); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Libraries", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(3); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("LibraryId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("LibraryId", "Status", "CreatedOnUtc") + .IsDescending(true, false, true); + + b.ToTable("LibraryScans", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanResultEntity", b => + { + b.Property("LibraryScanId") + .HasColumnType("TEXT"); + + b.Property("Path") + .HasMaxLength(1024) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("ContentHash") + .HasMaxLength(24) + .HasColumnType("INTEGER") + .HasColumnOrder(2); + + b.Property("FileSize") + .HasColumnType("INTEGER") + .HasColumnOrder(3); + + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("Status") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.Property("Ticks") + .HasColumnType("INTEGER") + .HasColumnOrder(4); + + b.HasKey("LibraryScanId", "Path"); + + b.HasIndex("Path"); + + b.HasIndex("ContentHash", "FileSize", "Path"); + + b.ToTable("LibraryScanResults", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanSnapshotEntity", b => + { + b.Property("LibraryId") + .HasColumnType("TEXT"); + + b.Property("Path") + .HasMaxLength(1024) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("ContentHash") + .HasColumnType("INTEGER") + .HasColumnOrder(2); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.Property("FileSize") + .HasColumnType("INTEGER") + .HasColumnOrder(3); + + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("Ticks") + .HasColumnType("INTEGER") + .HasColumnOrder(4); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(8); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(7); + + b.HasKey("LibraryId", "Path"); + + b.HasIndex("LibraryId"); + + b.ToTable("LibraryScanSnapshots", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanStagingResultsEntity", b => + { + b.Property("LibraryScanId") + .HasColumnType("TEXT"); + + b.Property("Path") + .HasMaxLength(1024) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("ContentHash") + .HasColumnType("INTEGER") + .HasColumnOrder(4); + + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("IsNew") + .HasColumnType("INTEGER") + .HasColumnOrder(7); + + b.Property("NeedsRehash") + .HasColumnType("INTEGER") + .HasColumnOrder(6); + + b.Property("PreviousContentHash") + .HasColumnType("INTEGER") + .HasColumnOrder(5); + + b.Property("Size") + .HasColumnType("INTEGER") + .HasColumnOrder(2); + + b.Property("Ticks") + .HasColumnType("INTEGER") + .HasColumnOrder(3); + + b.HasKey("LibraryScanId", "Path"); + + b.HasIndex("LibraryScanId", "NeedsRehash"); + + b.ToTable("LibraryScanStagingResults", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("ASIN") + .HasMaxLength(10) + .HasColumnType("TEXT") + .HasColumnOrder(21); + + b.Property("AppleBooksId") + .HasColumnType("TEXT") + .HasColumnOrder(29); + + b.Property("BarnesAndNobleId") + .HasMaxLength(10) + .HasColumnType("TEXT") + .HasColumnOrder(28); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(33); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(32); + + b.Property("Description") + .HasMaxLength(2000) + .HasColumnType("TEXT") + .HasColumnOrder(3); + + b.Property("Edition") + .HasMaxLength(50) + .HasColumnType("TEXT") + .HasColumnOrder(19); + + b.Property("Format") + .HasColumnType("TEXT") + .HasColumnOrder(18); + + b.Property("GoodreadsId") + .HasColumnType("TEXT") + .HasColumnOrder(22); + + b.Property("GoogleBooksId") + .HasMaxLength(12) + .HasColumnType("TEXT") + .HasColumnOrder(27); + + b.Property("LCCN") + .HasColumnType("TEXT") + .HasColumnOrder(23); + + b.Property("LanguageCode") + .HasColumnType("TEXT") + .HasColumnOrder(10); + + b.Property("LanguageName") + .HasColumnType("TEXT") + .HasColumnOrder(11); + + b.Property("LanguageNativeName") + .HasColumnType("TEXT") + .HasColumnOrder(12); + + b.Property("LastMetadataUpdateUtc") + .HasColumnType("TEXT") + .HasColumnOrder(39); + + b.Property("LibraryId") + .HasColumnType("TEXT") + .HasColumnOrder(36); + + b.Property("LibraryThingId") + .HasMaxLength(50) + .HasColumnType("TEXT") + .HasColumnOrder(26); + + b.Property("MetadataProvider") + .HasMaxLength(100) + .HasColumnType("TEXT") + .HasColumnOrder(40); + + b.Property("MetadataStatus") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT") + .HasColumnOrder(38); + + b.Property("OCLCNumber") + .HasColumnType("TEXT") + .HasColumnOrder(24); + + b.Property("OpenLibraryId") + .HasMaxLength(50) + .HasColumnType("TEXT") + .HasColumnOrder(25); + + b.Property("OriginalLanguageCode") + .HasColumnType("TEXT") + .HasColumnOrder(13); + + b.Property("OriginalLanguageName") + .HasColumnType("TEXT") + .HasColumnOrder(14); + + b.Property("OriginalLanguageNativeName") + .HasColumnType("TEXT") + .HasColumnOrder(15); + + b.Property("OriginalReleaseDate") + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("OriginalReleaseYear") + .HasColumnType("INTEGER") + .HasColumnOrder(5); + + b.Property("OriginalTitle") + .HasMaxLength(255) + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("PageCount") + .HasColumnType("INTEGER") + .HasColumnOrder(17); + + b.Property("Path") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("TEXT") + .HasColumnOrder(37); + + b.Property("Publisher") + .HasMaxLength(100) + .HasColumnType("TEXT") + .HasColumnOrder(16); + + b.Property("ReReleaseDate") + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.Property("ReReleaseYear") + .HasColumnType("INTEGER") + .HasColumnOrder(7); + + b.Property("ReleaseCountry") + .HasColumnType("TEXT") + .HasColumnOrder(8); + + b.Property("ReleaseVersion") + .HasColumnType("TEXT") + .HasColumnOrder(9); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(35); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(34); + + b.Property("VolumeNumber") + .HasColumnType("INTEGER") + .HasColumnOrder(20); + + b.HasKey("Id"); + + b.HasIndex("LibraryId", "MetadataStatus"); + + b.HasIndex("LibraryId", "Path"); + + b.ToTable("Books", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Plugins.LibraryMetadataProviderConfigurationEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.Property("IsEnabled") + .HasColumnType("INTEGER") + .HasColumnOrder(3); + + b.Property("LibraryId") + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("PluginId") + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("Rank") + .HasColumnType("INTEGER") + .HasColumnOrder(4); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(8); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(7); + + b.HasKey("Id"); + + b.HasIndex("LibraryId", "PluginId"); + + b.ToTable("LibraryMetadataProviderConfigurations", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Plugins.PluginEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("Author") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(9); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(8); + + b.Property("Description") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("LoadError") + .HasMaxLength(2000) + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.Property("LoadStatus") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("SettingsJson") + .HasColumnType("TEXT") + .HasColumnOrder(7); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(11); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(10); + + b.Property("Version") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT") + .HasColumnOrder(3); + + b.HasKey("Id"); + + b.ToTable("Plugins", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Themes.ThemeEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("Author") + .IsRequired() + .HasMaxLength(80) + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(12); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(11); + + b.Property("Description") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("TEXT") + .HasColumnOrder(3); + + b.Property("InstallSource") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnOrder(7); + + b.Property("InstalledAtUtc") + .HasColumnType("TEXT") + .HasColumnOrder(10); + + b.Property("IsCurrent") + .HasColumnType("INTEGER") + .HasColumnOrder(8); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(false) + .HasColumnOrder(9); + + b.Property("Name") + .IsRequired() + .HasMaxLength(80) + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("PreviewPath") + .HasMaxLength(240) + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.Property("ThemeId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(14); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(13); + + b.Property("Version") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.HasKey("Id"); + + b.HasIndex("IsCurrent") + .IsUnique() + .HasFilter("IsCurrent = 1"); + + b.HasIndex("ThemeId") + .IsUnique(); + + b.ToTable("Themes", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(7); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.Property("Password") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("TempPassword") + .HasColumnType("TEXT") + .HasColumnOrder(3); + + b.Property("TempPasswordCreated") + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.Property("TotpSecret") + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(9); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(8); + + b.Property("Username") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.HasKey("Id"); + + b.HasIndex("Username") + .IsUnique(); + + b.ToTable("Users", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserSettingsEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.Property("IgnoreThePrefixForAlphaPicker") + .HasColumnType("INTEGER") + .HasColumnOrder(4); + + b.Property("IsPaginationEnabled") + .HasColumnType("INTEGER") + .HasColumnOrder(2); + + b.Property("IsThemeCachingEnabled") + .HasColumnType("INTEGER") + .HasColumnOrder(9); + + b.Property("ItemsPerPage") + .HasColumnType("INTEGER") + .HasColumnOrder(3); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(8); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(7); + + b.Property("UserId") + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("UserSettings", (string)null); + }); + + modelBuilder.Entity("BookGenres", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", null) + .WithMany() + .HasForeignKey("BookId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lumina.Application.Common.DataAccess.Entities.Common.GenreEntity", null) + .WithMany() + .HasForeignKey("GenreId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("BookTags", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", null) + .WithMany() + .HasForeignKey("BookId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lumina.Application.Common.DataAccess.Entities.Common.TagEntity", null) + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.RolePermissionEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.Authorization.PermissionEntity", "Permission") + .WithMany("RolePermissions") + .HasForeignKey("PermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lumina.Application.Common.DataAccess.Entities.Authorization.RoleEntity", "Role") + .WithMany("RolePermissions") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Permission"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.UserPermissionEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.Authorization.PermissionEntity", "Permission") + .WithMany("UserPermissions") + .HasForeignKey("PermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", "User") + .WithMany("UserPermissions") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Permission"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.UserRoleEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.Authorization.RoleEntity", "Role") + .WithMany("UserRoles") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", "User") + .WithOne("UserRole") + .HasForeignKey("Lumina.Application.Common.DataAccess.Entities.Authorization.UserRoleEntity", "UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.DirectoryScanFingerprintEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryEntity", null) + .WithMany() + .HasForeignKey("LibraryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", "User") + .WithMany("Libraries") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryContentLocationEntity", "ContentLocations", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b1.Property("LibraryId") + .HasColumnType("TEXT"); + + b1.Property("Path") + .IsRequired() + .HasMaxLength(260) + .HasColumnType("TEXT") + .HasColumnName("Path"); + + b1.HasKey("Id"); + + b1.HasIndex("LibraryId"); + + b1.ToTable("LibraryContentLocations", (string)null); + + b1.WithOwner() + .HasForeignKey("LibraryId"); + }); + + b.Navigation("ContentLocations"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryEntity", "Library") + .WithMany("LibraryScans") + .HasForeignKey("LibraryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", "User") + .WithMany("LibraryScans") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Library"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanResultEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanEntity", "LibraryScan") + .WithMany("LibraryScanResults") + .HasForeignKey("LibraryScanId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("LibraryScan"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanSnapshotEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryEntity", "Library") + .WithMany() + .HasForeignKey("LibraryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Library"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanStagingResultsEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanEntity", null) + .WithMany() + .HasForeignKey("LibraryScanId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", b => + { + b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookRatingEntity", "Ratings", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b1.Property("BookId") + .HasColumnType("TEXT"); + + b1.Property("MaxValue") + .HasColumnType("decimal(3,2)"); + + b1.Property("Source") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b1.Property("Value") + .HasColumnType("decimal(3,2)"); + + b1.Property("VoteCount") + .HasColumnType("INTEGER"); + + b1.HasKey("Id"); + + b1.HasIndex("BookId"); + + b1.ToTable("BookRatings", (string)null); + + b1.WithOwner() + .HasForeignKey("BookId"); + }); + + b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.IsbnEntity", "ISBNs", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b1.Property("BookId") + .HasColumnType("TEXT"); + + b1.Property("Format") + .IsRequired() + .HasMaxLength(6) + .HasColumnType("TEXT"); + + b1.Property("Value") + .IsRequired() + .HasMaxLength(13) + .HasColumnType("TEXT") + .HasColumnName("ISBN"); + + b1.HasKey("Id"); + + b1.HasIndex("BookId"); + + b1.ToTable("BookISBNs", (string)null); + + b1.WithOwner() + .HasForeignKey("BookId"); + }); + + b.Navigation("ISBNs"); + + b.Navigation("Ratings"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserSettingsEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", null) + .WithOne() + .HasForeignKey("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserSettingsEntity", "UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.PermissionEntity", b => + { + b.Navigation("RolePermissions"); + + b.Navigation("UserPermissions"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.RoleEntity", b => + { + b.Navigation("RolePermissions"); + + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryEntity", b => + { + b.Navigation("LibraryScans"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanEntity", b => + { + b.Navigation("LibraryScanResults"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", b => + { + b.Navigation("Libraries"); + + b.Navigation("LibraryScans"); + + b.Navigation("UserPermissions"); + + b.Navigation("UserRole"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Lumina.DataAccess/Common/Migrations/20260821092546_AddsIsThemeCachingEnabledToUserSettings.cs b/src/Lumina.DataAccess/Common/Migrations/20260821092546_AddsIsThemeCachingEnabledToUserSettings.cs new file mode 100644 index 00000000..60fddf8c --- /dev/null +++ b/src/Lumina.DataAccess/Common/Migrations/20260821092546_AddsIsThemeCachingEnabledToUserSettings.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Lumina.DataAccess.Common.Migrations +{ + /// + public partial class AddsIsThemeCachingEnabledToUserSettings : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IsThemeCachingEnabled", + table: "UserSettings", + type: "INTEGER", + nullable: false, + defaultValue: true) + .Annotation("Relational:ColumnOrder", 9); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "IsThemeCachingEnabled", + table: "UserSettings"); + } + } +} diff --git a/src/Lumina.DataAccess/Common/Migrations/LuminaDbContextModelSnapshot.cs b/src/Lumina.DataAccess/Common/Migrations/LuminaDbContextModelSnapshot.cs index d21b069d..3bf74c6a 100644 --- a/src/Lumina.DataAccess/Common/Migrations/LuminaDbContextModelSnapshot.cs +++ b/src/Lumina.DataAccess/Common/Migrations/LuminaDbContextModelSnapshot.cs @@ -972,6 +972,10 @@ namespace Lumina.DataAccess.Common.Migrations .HasColumnType("INTEGER") .HasColumnOrder(2); + b.Property("IsThemeCachingEnabled") + .HasColumnType("INTEGER") + .HasColumnOrder(9); + b.Property("ItemsPerPage") .HasColumnType("INTEGER") .HasColumnOrder(3); diff --git a/src/Lumina.Domain/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettings.cs b/src/Lumina.Domain/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettings.cs index 46f5d0df..6cd60fc9 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettings.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettings.cs @@ -19,6 +19,7 @@ public class UserSettings : AggregateRoot private const bool DEFAULT_IS_PAGINATION_ENABLED = true; private const int DEFAULT_ITEMS_PER_PAGE = 48; private const bool DEFAULT_IGNORE_THE_PREFIX_FOR_ALPHA_PICKER = false; + private const bool DEFAULT_IS_THEME_CACHING_ENABLED = true; /// /// Gets the object representing the unique identifier of the user that owns these settings. @@ -40,6 +41,11 @@ public class UserSettings : AggregateRoot /// public bool IgnoreThePrefixForAlphaPicker { get; private set; } + /// + /// Gets whether the theme data served to this user is cached, or not. + /// + public bool IsThemeCachingEnabled { get; private set; } + /// /// Initializes a new instance of the class. /// @@ -48,17 +54,20 @@ public class UserSettings : AggregateRoot /// Whether pagination is enabled for the user, or not. /// The number of library items displayed per page when pagination is enabled. /// Whether the "The" prefix of library item titles is ignored by the alpha picker, or not. + /// Whether the theme data served to this user is cached, or not. private UserSettings( UserSettingsId id, UserId userId, bool isPaginationEnabled, int itemsPerPage, - bool ignoreThePrefixForAlphaPicker) : base(id) + bool ignoreThePrefixForAlphaPicker, + bool isThemeCachingEnabled) : base(id) { UserId = userId; IsPaginationEnabled = isPaginationEnabled; ItemsPerPage = itemsPerPage; IgnoreThePrefixForAlphaPicker = ignoreThePrefixForAlphaPicker; + IsThemeCachingEnabled = isThemeCachingEnabled; } /// @@ -69,7 +78,7 @@ public class UserSettings : AggregateRoot /// public static Result Create() { - return Create(UserId.CreateUnique(), DEFAULT_IS_PAGINATION_ENABLED, DEFAULT_ITEMS_PER_PAGE, DEFAULT_IGNORE_THE_PREFIX_FOR_ALPHA_PICKER); + return Create(UserId.CreateUnique(), DEFAULT_IS_PAGINATION_ENABLED, DEFAULT_ITEMS_PER_PAGE, DEFAULT_IGNORE_THE_PREFIX_FOR_ALPHA_PICKER, DEFAULT_IS_THEME_CACHING_ENABLED); } /// @@ -81,7 +90,7 @@ public class UserSettings : AggregateRoot /// public static Result Create(UserId userId) { - return Create(userId, DEFAULT_IS_PAGINATION_ENABLED, DEFAULT_ITEMS_PER_PAGE, DEFAULT_IGNORE_THE_PREFIX_FOR_ALPHA_PICKER); + return Create(userId, DEFAULT_IS_PAGINATION_ENABLED, DEFAULT_ITEMS_PER_PAGE, DEFAULT_IGNORE_THE_PREFIX_FOR_ALPHA_PICKER, DEFAULT_IS_THEME_CACHING_ENABLED); } /// @@ -91,6 +100,7 @@ public class UserSettings : AggregateRoot /// Whether pagination is enabled for the user, or not. /// The number of library items displayed per page when pagination is enabled. /// Whether the "The" prefix of library item titles is ignored by the alpha picker, or not. + /// Whether the theme data served to this user is cached, or not. /// /// An containing either a successfully created , or an error message. /// @@ -98,7 +108,8 @@ public class UserSettings : AggregateRoot UserId userId, bool isPaginationEnabled, int itemsPerPage, - bool ignoreThePrefixForAlphaPicker) + bool ignoreThePrefixForAlphaPicker, + bool isThemeCachingEnabled) { if (itemsPerPage <= 0) return Errors.UserSettings.ItemsPerPageMustBeGreaterThanZero; @@ -108,7 +119,8 @@ public class UserSettings : AggregateRoot userId, isPaginationEnabled, itemsPerPage, - ignoreThePrefixForAlphaPicker); + ignoreThePrefixForAlphaPicker, + isThemeCachingEnabled); } /// @@ -119,6 +131,7 @@ public class UserSettings : AggregateRoot /// Whether pagination is enabled for the user, or not. /// The number of library items displayed per page when pagination is enabled. /// Whether the "The" prefix of library item titles is ignored by the alpha picker, or not. + /// Whether the theme data served to this user is cached, or not. /// /// An containing either a successfully created , or an error message. /// @@ -127,12 +140,13 @@ public class UserSettings : AggregateRoot UserId userId, bool isPaginationEnabled, int itemsPerPage, - bool ignoreThePrefixForAlphaPicker) + bool ignoreThePrefixForAlphaPicker, + bool isThemeCachingEnabled) { if (itemsPerPage <= 0) return Errors.UserSettings.ItemsPerPageMustBeGreaterThanZero; - return new UserSettings(id, userId, isPaginationEnabled, itemsPerPage, ignoreThePrefixForAlphaPicker); + return new UserSettings(id, userId, isPaginationEnabled, itemsPerPage, ignoreThePrefixForAlphaPicker, isThemeCachingEnabled); } /// @@ -141,11 +155,13 @@ public class UserSettings : AggregateRoot /// Whether pagination is enabled for the user, or not. /// The number of library items displayed per page when pagination is enabled. /// Whether the "The" prefix of library item titles is ignored by the alpha picker, or not. + /// Whether the theme data served to this user is cached, or not. /// An representing either a successful update, or an error. public Result UpdateSettings( bool isPaginationEnabled, int itemsPerPage, - bool ignoreThePrefixForAlphaPicker) + bool ignoreThePrefixForAlphaPicker, + bool isThemeCachingEnabled) { if (itemsPerPage <= 0) return Errors.UserSettings.ItemsPerPageMustBeGreaterThanZero; @@ -153,6 +169,7 @@ public class UserSettings : AggregateRoot IsPaginationEnabled = isPaginationEnabled; ItemsPerPage = itemsPerPage; IgnoreThePrefixForAlphaPicker = ignoreThePrefixForAlphaPicker; + IsThemeCachingEnabled = isThemeCachingEnabled; return Result.Updated; } } diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/GetUserSettings/GetUserSettingsEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/GetUserSettings/GetUserSettingsEndpointSummary.cs index a8446d03..4d0df558 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/GetUserSettings/GetUserSettingsEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/GetUserSettings/GetUserSettingsEndpointSummary.cs @@ -26,7 +26,8 @@ public class GetUserSettingsEndpointSummary : Summary r.IsPaginationEnabled, "Whether pagination is enabled for the user, or not. Required."); + RequestParam(r => r.ItemsPerPage, "The number of library items displayed per page when pagination is enabled. Required."); + RequestParam(r => r.IgnoreThePrefixForAlphaPicker, "Whether the \"The\" prefix of library item titles is ignored by the alpha picker, or not. Required."); + RequestParam(r => r.IsThemeCachingEnabled, "Whether the theme data served to this user is cached, or not. Required."); + Response(200, "The settings of the current user were successfully updated."); Response(401, "Authentication required.", "application/problem+json", diff --git a/src/Lumina.Presentation.Web/Common/DTO/UsersManagement/UserSettingsDto.cs b/src/Lumina.Presentation.Web/Common/DTO/UsersManagement/UserSettingsDto.cs index ad009888..c074a3c6 100644 --- a/src/Lumina.Presentation.Web/Common/DTO/UsersManagement/UserSettingsDto.cs +++ b/src/Lumina.Presentation.Web/Common/DTO/UsersManagement/UserSettingsDto.cs @@ -30,4 +30,9 @@ public class UserSettingsDto /// Gets or sets whether the "The" prefix of library item titles is ignored by the alpha picker, or not. /// public bool IgnoreThePrefixForAlphaPicker { get; set; } + + /// + /// Gets or sets whether the theme data served to this user is cached, or not. + /// + public bool IsThemeCachingEnabled { get; set; } = true; } diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/GetUserSettings/GetUserSettingsEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/GetUserSettings/GetUserSettingsEndpoint.cs index 9dd135dc..4e899751 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/GetUserSettings/GetUserSettingsEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/GetUserSettings/GetUserSettingsEndpoint.cs @@ -3,9 +3,12 @@ using FastEndpoints; using Lumina.Presentation.Web.Common.Api; using Lumina.Presentation.Web.Common.DTO.UsersManagement; using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Common.Services; using Lumina.Presentation.Web.Core.Endpoints.Common; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; +using System; +using System.Security.Claims; using System.Threading; using System.Threading.Tasks; #endregion @@ -18,14 +21,17 @@ namespace Lumina.Presentation.Web.Core.Endpoints.Tools.Settings.GetUserSettings; public class GetUserSettingsEndpoint : BaseEndpoint { private readonly IApiHttpClient _apiHttpClient; + private readonly ThemeCachePreferenceService _themeCachePreferenceService; /// /// Initializes a new instance of the class. /// /// Injected service for interactions with the API. - public GetUserSettingsEndpoint(IApiHttpClient apiHttpClient) + /// Injected service for storing the per-user theme cache preference. + public GetUserSettingsEndpoint(IApiHttpClient apiHttpClient, ThemeCachePreferenceService themeCachePreferenceService) { _apiHttpClient = apiHttpClient; + _themeCachePreferenceService = themeCachePreferenceService; } /// @@ -48,6 +54,22 @@ public class GetUserSettingsEndpoint : BaseEndpoint public override async Task ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken) { UserSettingsDto response = await _apiHttpClient.GetAsync(ApiRoutes.Users.GET_USER_SETTINGS, cancellationToken).ConfigureAwait(false); + + // refresh the per-user theme cache preference from the stored settings, so the handler always applies the latest value + Guid? userId = GetCurrentUserId(); + if (userId is not null) + await _themeCachePreferenceService.SetAsync(userId.Value, response.IsThemeCachingEnabled, cancellationToken).ConfigureAwait(false); + return JsonSuccess(response); } + + /// + /// Gets the unique identifier of the currently authenticated user. + /// + /// The unique identifier of the current user, or when the request is anonymous. + private Guid? GetCurrentUserId() + { + string? userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; + return Guid.TryParse(userId, out Guid parsedUserId) ? parsedUserId : null; + } } diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/UpdateUserSettings/UpdateUserSettingsEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/UpdateUserSettings/UpdateUserSettingsEndpoint.cs index 044f7440..82530e78 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/UpdateUserSettings/UpdateUserSettingsEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/UpdateUserSettings/UpdateUserSettingsEndpoint.cs @@ -3,9 +3,12 @@ using FastEndpoints; using Lumina.Presentation.Web.Common.Api; using Lumina.Presentation.Web.Common.DTO.UsersManagement; using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Common.Services; using Lumina.Presentation.Web.Core.Endpoints.Common; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; +using System; +using System.Security.Claims; using System.Threading; using System.Threading.Tasks; #endregion @@ -18,14 +21,17 @@ namespace Lumina.Presentation.Web.Core.Endpoints.Tools.Settings.UpdateUserSettin public class UpdateUserSettingsEndpoint : BaseEndpoint { private readonly IApiHttpClient _apiHttpClient; + private readonly ThemeCachePreferenceService _themeCachePreferenceService; /// /// Initializes a new instance of the class. /// /// Injected service for interactions with the API. - public UpdateUserSettingsEndpoint(IApiHttpClient apiHttpClient) + /// Injected service for storing the per-user theme cache preference. + public UpdateUserSettingsEndpoint(IApiHttpClient apiHttpClient, ThemeCachePreferenceService themeCachePreferenceService) { _apiHttpClient = apiHttpClient; + _themeCachePreferenceService = themeCachePreferenceService; } /// @@ -49,6 +55,22 @@ public class UpdateUserSettingsEndpoint : BaseEndpoint public override async Task ExecuteAsync(UserSettingsDto request, CancellationToken cancellationToken) { await _apiHttpClient.PutAsync(ApiRoutes.Users.UPDATE_USER_SETTINGS, request, cancellationToken).ConfigureAwait(false); + + // keep the per-user theme cache preference in sync with the stored settings, so the handler applies it immediately + Guid? userId = GetCurrentUserId(); + if (userId is not null) + await _themeCachePreferenceService.SetAsync(userId.Value, request.IsThemeCachingEnabled, cancellationToken).ConfigureAwait(false); + return JsonSuccess(new { isUpdated = true }); } + + /// + /// Gets the unique identifier of the currently authenticated user. + /// + /// The unique identifier of the current user, or when the request is anonymous. + private Guid? GetCurrentUserId() + { + string? userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; + return Guid.TryParse(userId, out Guid parsedUserId) ? parsedUserId : null; + } } diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.de-DE.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.de-DE.resx index 7f312406..5f1d8361 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.de-DE.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.de-DE.resx @@ -39,4 +39,10 @@ Wenn aktiviert, werden Bibliothekselemente, deren Titel mit "The" beginnt, in der Alpha-Auswahl unter dem ersten Buchstaben des folgenden Wortes gruppiert, z. B. wird "The Rasmus" unter R aufgeführt. + + Themencache aktivieren + + + Gibt an, ob die von der Anwendung bereitgestellten Themendateien zwischengespeichert werden. Deaktivieren Sie diese Option beim Bearbeiten von Themendateien, damit die Änderungen sofort erscheinen. + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.en-US.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.en-US.resx index d7ecb8c2..da463e75 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.en-US.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.en-US.resx @@ -39,4 +39,10 @@ When enabled, library items whose title begins with "The" are grouped under the first letter of the following word in the alpha picker, e.g. "The Rasmus" is listed under R. + + Enable theme caching + + + Whether the theme files served by the application are cached. Turn this off while editing theme files so the changes appear immediately. + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.es-ES.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.es-ES.resx index 46197a4f..0cfad2b5 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.es-ES.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.es-ES.resx @@ -39,4 +39,10 @@ Cuando está habilitado, los elementos de la biblioteca cuyo título comienza con "The" se agrupan bajo la primera letra de la palabra siguiente en el selector alfabético, por ejemplo, "The Rasmus" se lista bajo R. + + Habilitar caché de temas + + + Controla si los archivos de temas servidos por la aplicación se almacenan en caché. Desactívelo mientras edita archivos de temas para que los cambios aparezcan inmediatamente. + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.fr-FR.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.fr-FR.resx index 0d086bdd..7327abbf 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.fr-FR.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.fr-FR.resx @@ -39,4 +39,10 @@ Lorsque cette option est activée, les éléments de la bibliothèque dont le titre commence par "The" sont regroupés sous la première lettre du mot suivant dans le sélecteur alphabétique, par exemple "The Rasmus" est répertorié sous R. + + Activer le cache des thèmes + + + Contrôle si les fichiers de thèmes servis par l'application sont mis en cache. Désactivez-le pendant la modification des fichiers de thèmes afin que les changements apparaissent immédiatement. + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.it-IT.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.it-IT.resx index f88da291..c29b3a31 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.it-IT.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.it-IT.resx @@ -39,4 +39,10 @@ Se abilitato, gli elementi della libreria il cui titolo inizia con "The" vengono raggruppati sotto la prima lettera della parola successiva nel selettore alfabetico, ad esempio "The Rasmus" è elencato sotto R. + + Abilita la cache dei temi + + + Controlla se i file dei temi serviti dall'applicazione vengono memorizzati nella cache. Disattivalo mentre modifichi i file dei temi affinché le modifiche appaiano immediatamente. + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ja-JP.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ja-JP.resx index 78c7e46f..6dc95ed9 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ja-JP.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ja-JP.resx @@ -39,4 +39,10 @@ 有効にすると、タイトルが「The」で始まるライブラリの項目は、アルファピッカーで次の単語の最初の文字の下にグループ化されます。たとえば「The Rasmus」は「R」の下に表示されます。 + + テーマキャッシュを有効にする + + + アプリケーションが提供するテーマファイルをキャッシュするかどうかを制御します。テーマファイルを編集している間はオフにして、変更がすぐに反映されるようにします。 + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.resx index d7ecb8c2..da463e75 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.resx @@ -39,4 +39,10 @@ When enabled, library items whose title begins with "The" are grouped under the first letter of the following word in the alpha picker, e.g. "The Rasmus" is listed under R. + + Enable theme caching + + + Whether the theme files served by the application are cached. Turn this off while editing theme files so the changes appear immediately. + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ro-RO.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ro-RO.resx index add6888f..b36b2406 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ro-RO.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ro-RO.resx @@ -39,4 +39,10 @@ Când este activată, elementele bibliotecii al căror titlu începe cu "The" sunt grupate sub prima literă a cuvântului următor în selectorul alfabetic, de exemplu "The Rasmus" este listat sub R. + + Activează cache-ul temelor + + + Controlează dacă fișierele temelor servite de aplicație sunt puse în cache. Dezactivați această opțiune în timp ce editați fișierele temelor, pentru ca modificările să apară imediat. + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ru-RU.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ru-RU.resx index 5657d5a6..e44f8385 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ru-RU.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ru-RU.resx @@ -39,4 +39,10 @@ При включении элементы библиотеки, название которых начинается с "The", группируются в алфавитном указателе под первой буквой следующего слова, например "The Rasmus" отображается под буквой R. + + Включить кэширование тем + + + Определяет, кэшируются ли файлы тем, предоставляемые приложением. Отключите эту опцию при редактировании файлов тем, чтобы изменения отображались сразу. + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.zh-CN.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.zh-CN.resx index 00301a1b..857dd54f 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.zh-CN.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.zh-CN.resx @@ -39,4 +39,10 @@ 启用后,标题以"The"开头的库项目将在字母选择器中按后一个词的首字母分组,例如"The Rasmus"会列在R下。 + + 启用主题缓存 + + + 控制应用程序提供的主题文件是否缓存。编辑主题文件时请关闭此选项,以便更改立即生效。 + diff --git a/src/Lumina.Presentation.Web/Core/Views/Tools/Settings.cshtml b/src/Lumina.Presentation.Web/Core/Views/Tools/Settings.cshtml index 7ea8be9a..7f62b856 100644 --- a/src/Lumina.Presentation.Web/Core/Views/Tools/Settings.cshtml +++ b/src/Lumina.Presentation.Web/Core/Views/Tools/Settings.cshtml @@ -65,6 +65,19 @@ @_localizer["DescriptionIgnoreThePrefixForAlphaPicker"] + +
+
+ : +
+
+ +
+ @_localizer["DescriptionEnableThemeCaching"] +
@@ -82,6 +95,7 @@ const checkboxIsPaginationEnabled = document.getElementById('IsPaginationEnabled'); const inputItemsPerPage = document.getElementById('ItemsPerPage'); const checkboxIgnoreThePrefixForAlphaPicker = document.getElementById('IgnoreThePrefixForAlphaPicker'); + const checkboxIsThemeCachingEnabled = document.getElementById('IsThemeCachingEnabled'); // toggle the enabled state of the items per page input based on the pagination checkbox function updateItemsPerPageEnabledState() { @@ -95,6 +109,7 @@ checkboxIsPaginationEnabled.checked = data.isPaginationEnabled === true; inputItemsPerPage.value = data.itemsPerPage; checkboxIgnoreThePrefixForAlphaPicker.checked = data.ignoreThePrefixForAlphaPicker === true; + checkboxIsThemeCachingEnabled.checked = data.isThemeCachingEnabled === true; updateItemsPerPageEnabledState(); } } @@ -104,7 +119,8 @@ const formData = { IsPaginationEnabled: checkboxIsPaginationEnabled.checked, ItemsPerPage: Number(inputItemsPerPage.value), - IgnoreThePrefixForAlphaPicker: checkboxIgnoreThePrefixForAlphaPicker.checked + IgnoreThePrefixForAlphaPicker: checkboxIgnoreThePrefixForAlphaPicker.checked, + IsThemeCachingEnabled: checkboxIsThemeCachingEnabled.checked }; const data = await callApiPostAsync('@_urlService.GetAbsoluteUrl(WebRoutes.Settings.UPDATE_USER_SETTINGS)', formData); if (data && data.isUpdated === true) diff --git a/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/UsersManagement/UserSettingsEntityFixture.cs b/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/UsersManagement/UserSettingsEntityFixture.cs index d11a1fdc..e6e86104 100644 --- a/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/UsersManagement/UserSettingsEntityFixture.cs +++ b/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/UsersManagement/UserSettingsEntityFixture.cs @@ -23,13 +23,15 @@ public class UserSettingsEntityFixture /// Optional. Whether pagination is enabled for the user, or not. /// Optional. The number of library items displayed per page when pagination is enabled. /// Optional. Whether the "The" prefix is ignored by the alpha picker, or not. + /// Optional. Whether the theme data served to this user is cached, or not. /// The created user settings entity. public UserSettingsEntity Create( Guid? id = null, Guid? userId = null, bool? isPaginationEnabled = null, int? itemsPerPage = null, - bool? ignoreThePrefixForAlphaPicker = null) + bool? ignoreThePrefixForAlphaPicker = null, + bool? isThemeCachingEnabled = null) { return new Faker() .CustomInstantiator(f => new UserSettingsEntity @@ -38,7 +40,8 @@ public class UserSettingsEntityFixture UserId = userId ?? Guid.NewGuid(), IsPaginationEnabled = isPaginationEnabled ?? f.Random.Bool(), ItemsPerPage = itemsPerPage ?? f.Random.Int(1, 100), - IgnoreThePrefixForAlphaPicker = ignoreThePrefixForAlphaPicker ?? f.Random.Bool() + IgnoreThePrefixForAlphaPicker = ignoreThePrefixForAlphaPicker ?? f.Random.Bool(), + IsThemeCachingEnabled = isThemeCachingEnabled ?? f.Random.Bool() }) .Generate(); } diff --git a/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandFixture.cs index 7fc9e855..d26b85c7 100644 --- a/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandFixture.cs +++ b/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandFixture.cs @@ -20,17 +20,20 @@ public class UpdateUserSettingsCommandFixture /// Optional. Whether pagination is enabled for the user, or not. /// Optional. The number of library items displayed per page when pagination is enabled. /// Optional. Whether the "The" prefix is ignored by the alpha picker, or not. + /// Optional. Whether the theme data served to this user is cached, or not. /// The created command. public UpdateUserSettingsCommand Create( bool? isPaginationEnabled = null, int? itemsPerPage = null, - bool? ignoreThePrefixForAlphaPicker = null) + bool? ignoreThePrefixForAlphaPicker = null, + bool? isThemeCachingEnabled = null) { return new Faker() - .CustomInstantiator(f => new UpdateUserSettingsCommand(default, default, default)) + .CustomInstantiator(f => new UpdateUserSettingsCommand(default, default, default, default)) .RuleFor(x => x.IsPaginationEnabled, f => isPaginationEnabled ?? f.Random.Bool()) .RuleFor(x => x.ItemsPerPage, f => itemsPerPage ?? f.Random.Int(1, 100)) .RuleFor(x => x.IgnoreThePrefixForAlphaPicker, f => ignoreThePrefixForAlphaPicker ?? f.Random.Bool()) + .RuleFor(x => x.IsThemeCachingEnabled, f => isThemeCachingEnabled ?? f.Random.Bool()) .Generate(); } diff --git a/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsFixture.cs b/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsFixture.cs index dc4ffd36..89134b4e 100644 --- a/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsFixture.cs +++ b/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsFixture.cs @@ -23,18 +23,21 @@ public class UserSettingsFixture /// Whether pagination is enabled for the user. /// The number of library items displayed per page when pagination is enabled. /// Whether the "The" prefix of library item titles is ignored by the alpha picker. + /// Whether the theme data served to this user is cached. /// The created . public UserSettings Create( Guid? userId = null, bool isPaginationEnabled = true, int itemsPerPage = 48, - bool ignoreThePrefixForAlphaPicker = false) + bool ignoreThePrefixForAlphaPicker = false, + bool isThemeCachingEnabled = true) { Result settings = UserSettings.Create( userId is null ? UserId.CreateUnique() : UserId.Create(userId.Value), isPaginationEnabled, itemsPerPage, - ignoreThePrefixForAlphaPicker); + ignoreThePrefixForAlphaPicker, + isThemeCachingEnabled); return settings.Value; } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs index 34faea2e..105106e8 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs @@ -59,7 +59,8 @@ public class UpdateUserSettingsEndpointTests : IClassFixture UpdateUserSettingsRequest request = new( IsPaginationEnabled: true, ItemsPerPage: 48, - IgnoreThePrefixForAlphaPicker: false + IgnoreThePrefixForAlphaPicker: false, + IsThemeCachingEnabled: true ); // Act @@ -79,7 +80,8 @@ public class UpdateUserSettingsEndpointTests : IClassFixture UpdateUserSettingsRequest request = new( IsPaginationEnabled: true, ItemsPerPage: int.MaxValue, - IgnoreThePrefixForAlphaPicker: false + IgnoreThePrefixForAlphaPicker: false, + IsThemeCachingEnabled: true ); // Act @@ -101,7 +103,8 @@ public class UpdateUserSettingsEndpointTests : IClassFixture UpdateUserSettingsRequest request = new( IsPaginationEnabled: true, ItemsPerPage: int.MinValue, - IgnoreThePrefixForAlphaPicker: false + IgnoreThePrefixForAlphaPicker: false, + IsThemeCachingEnabled: true ); // Act diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UpdateUserSettingsRequestMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UpdateUserSettingsRequestMappingTests.cs index 52e66af8..3a7aa785 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UpdateUserSettingsRequestMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UpdateUserSettingsRequestMappingTests.cs @@ -17,7 +17,7 @@ public class UpdateUserSettingsRequestMappingTests public void ToCommand_WhenMappingValidRequest_ShouldMapCorrectly() { // Arrange - UpdateUserSettingsRequest request = new(IsPaginationEnabled: true, ItemsPerPage: 48, IgnoreThePrefixForAlphaPicker: false); + UpdateUserSettingsRequest request = new(IsPaginationEnabled: true, ItemsPerPage: 48, IgnoreThePrefixForAlphaPicker: false, IsThemeCachingEnabled: true); // Act UpdateUserSettingsCommand result = request.ToCommand(); @@ -27,5 +27,6 @@ public class UpdateUserSettingsRequestMappingTests Assert.Equal(request.IsPaginationEnabled, result.IsPaginationEnabled); Assert.Equal(request.ItemsPerPage, result.ItemsPerPage); Assert.Equal(request.IgnoreThePrefixForAlphaPicker, result.IgnoreThePrefixForAlphaPicker); + Assert.Equal(request.IsThemeCachingEnabled, result.IsThemeCachingEnabled); } } diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UserSettingsEntityMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UserSettingsEntityMappingTests.cs index 5ac4822a..f87c367b 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UserSettingsEntityMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UserSettingsEntityMappingTests.cs @@ -34,6 +34,7 @@ public class UserSettingsEntityMappingTests Assert.Equal(entity.IsPaginationEnabled, result.Value.IsPaginationEnabled); Assert.Equal(entity.ItemsPerPage, result.Value.ItemsPerPage); Assert.Equal(entity.IgnoreThePrefixForAlphaPicker, result.Value.IgnoreThePrefixForAlphaPicker); + Assert.Equal(entity.IsThemeCachingEnabled, result.Value.IsThemeCachingEnabled); } [Fact] @@ -51,5 +52,6 @@ public class UserSettingsEntityMappingTests Assert.Equal(entity.IsPaginationEnabled, result.IsPaginationEnabled); Assert.Equal(entity.ItemsPerPage, result.ItemsPerPage); Assert.Equal(entity.IgnoreThePrefixForAlphaPicker, result.IgnoreThePrefixForAlphaPicker); + Assert.Equal(entity.IsThemeCachingEnabled, result.IsThemeCachingEnabled); } } diff --git a/tests/UnitTests/Lumina.Contracts.UnitTests/Requests/UsersManagement/Settings/UpdateUserSettingsRequestTests.cs b/tests/UnitTests/Lumina.Contracts.UnitTests/Requests/UsersManagement/Settings/UpdateUserSettingsRequestTests.cs index 44bfcd8b..a8b6cbfc 100644 --- a/tests/UnitTests/Lumina.Contracts.UnitTests/Requests/UsersManagement/Settings/UpdateUserSettingsRequestTests.cs +++ b/tests/UnitTests/Lumina.Contracts.UnitTests/Requests/UsersManagement/Settings/UpdateUserSettingsRequestTests.cs @@ -21,7 +21,7 @@ public class UpdateUserSettingsRequestTests public void RoundTrip_WhenSerializingUpdateUserSettingsRequest_ShouldPreserveValues() { // Arrange - UpdateUserSettingsRequest expected = new(true, 50, true); + UpdateUserSettingsRequest expected = new(true, 50, true, true); // Act string json = JsonSerializer.Serialize(expected, _jsonOptions); @@ -36,14 +36,15 @@ public class UpdateUserSettingsRequestTests public void Deconstruct_WhenCalled_ShouldReturnAllProperties() { // Arrange - UpdateUserSettingsRequest sut = new(false, 25, false); + UpdateUserSettingsRequest sut = new(false, 25, false, false); // Act - (bool isPaginationEnabled, int itemsPerPage, bool ignoreThePrefixForAlphaPicker) = sut; + (bool isPaginationEnabled, int itemsPerPage, bool ignoreThePrefixForAlphaPicker, bool isThemeCachingEnabled) = sut; // Assert Assert.Equal(sut.IsPaginationEnabled, isPaginationEnabled); Assert.Equal(sut.ItemsPerPage, itemsPerPage); Assert.Equal(sut.IgnoreThePrefixForAlphaPicker, ignoreThePrefixForAlphaPicker); + Assert.Equal(sut.IsThemeCachingEnabled, isThemeCachingEnabled); } } diff --git a/tests/UnitTests/Lumina.Contracts.UnitTests/Responses/UsersManagement/Settings/UserSettingsResponseTests.cs b/tests/UnitTests/Lumina.Contracts.UnitTests/Responses/UsersManagement/Settings/UserSettingsResponseTests.cs index ac566276..0bd9c3ff 100644 --- a/tests/UnitTests/Lumina.Contracts.UnitTests/Responses/UsersManagement/Settings/UserSettingsResponseTests.cs +++ b/tests/UnitTests/Lumina.Contracts.UnitTests/Responses/UsersManagement/Settings/UserSettingsResponseTests.cs @@ -23,7 +23,7 @@ public class UserSettingsResponseTests { // Arrange Guid userId = Guid.NewGuid(); - UserSettingsResponse expected = new(userId, true, 50, true); + UserSettingsResponse expected = new(userId, true, 50, true, true); // Act string json = JsonSerializer.Serialize(expected, _jsonOptions); @@ -39,15 +39,16 @@ public class UserSettingsResponseTests { // Arrange Guid userId = Guid.NewGuid(); - UserSettingsResponse sut = new(userId, false, 25, false); + UserSettingsResponse sut = new(userId, false, 25, false, false); // Act - (Guid sutUserId, bool isPaginationEnabled, int itemsPerPage, bool ignoreThePrefixForAlphaPicker) = sut; + (Guid sutUserId, bool isPaginationEnabled, int itemsPerPage, bool ignoreThePrefixForAlphaPicker, bool isThemeCachingEnabled) = sut; // Assert Assert.Equal(sut.UserId, sutUserId); Assert.Equal(sut.IsPaginationEnabled, isPaginationEnabled); Assert.Equal(sut.ItemsPerPage, itemsPerPage); Assert.Equal(sut.IgnoreThePrefixForAlphaPicker, ignoreThePrefixForAlphaPicker); + Assert.Equal(sut.IsThemeCachingEnabled, isThemeCachingEnabled); } } diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsTests.cs index 8b0460c0..d1abc2cf 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsTests.cs @@ -72,7 +72,7 @@ public class UserSettingsTests UserId userId = _userIdFixture.Create(); // Act - Result result = UserSettings.Create(userId, isPaginationEnabled: false, itemsPerPage: 24, ignoreThePrefixForAlphaPicker: true); + Result result = UserSettings.Create(userId, isPaginationEnabled: false, itemsPerPage: 24, ignoreThePrefixForAlphaPicker: true, isThemeCachingEnabled: true); // Assert Assert.False(result.IsFailure); @@ -80,6 +80,7 @@ public class UserSettingsTests Assert.False(result.Value.IsPaginationEnabled); Assert.Equal(24, result.Value.ItemsPerPage); Assert.True(result.Value.IgnoreThePrefixForAlphaPicker); + Assert.True(result.Value.IsThemeCachingEnabled); } [Fact] @@ -105,7 +106,7 @@ public class UserSettingsTests UserId userId = _userIdFixture.Create(); // Act - Result result = UserSettings.Create(userId, isPaginationEnabled: true, itemsPerPage: itemsPerPage, ignoreThePrefixForAlphaPicker: false); + Result result = UserSettings.Create(userId, isPaginationEnabled: true, itemsPerPage: itemsPerPage, ignoreThePrefixForAlphaPicker: false, isThemeCachingEnabled: true); // Assert Assert.True(result.IsFailure); @@ -119,13 +120,14 @@ public class UserSettingsTests UserSettings userSettings = _userSettingsFixture.Create(); // Act - Result result = userSettings.UpdateSettings(isPaginationEnabled: false, itemsPerPage: 12, ignoreThePrefixForAlphaPicker: true); + Result result = userSettings.UpdateSettings(isPaginationEnabled: false, itemsPerPage: 12, ignoreThePrefixForAlphaPicker: true, isThemeCachingEnabled: false); // Assert Assert.False(result.IsFailure); Assert.False(userSettings.IsPaginationEnabled); Assert.Equal(12, userSettings.ItemsPerPage); Assert.True(userSettings.IgnoreThePrefixForAlphaPicker); + Assert.False(userSettings.IsThemeCachingEnabled); } [Theory] @@ -137,7 +139,7 @@ public class UserSettingsTests UserSettings userSettings = _userSettingsFixture.Create(); // Act - Result result = userSettings.UpdateSettings(isPaginationEnabled: true, itemsPerPage: itemsPerPage, ignoreThePrefixForAlphaPicker: false); + Result result = userSettings.UpdateSettings(isPaginationEnabled: true, itemsPerPage: itemsPerPage, ignoreThePrefixForAlphaPicker: false, isThemeCachingEnabled: true); // Assert Assert.True(result.IsFailure); diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/UsersManagement/Settings/GetUserSettings/GetUserSettingsEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/UsersManagement/Settings/GetUserSettings/GetUserSettingsEndpointTests.cs index 122bb46c..190e76d7 100644 --- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/UsersManagement/Settings/GetUserSettings/GetUserSettingsEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/UsersManagement/Settings/GetUserSettings/GetUserSettingsEndpointTests.cs @@ -39,7 +39,7 @@ public class GetUserSettingsEndpointTests { // Arrange CancellationToken cancellationToken = CancellationToken.None; - UserSettingsResponse expectedResponse = new(Guid.NewGuid(), true, 48, false); + UserSettingsResponse expectedResponse = new(Guid.NewGuid(), true, 48, false, true); _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) .Returns(Result.From(expectedResponse)); @@ -79,7 +79,7 @@ public class GetUserSettingsEndpointTests // Arrange CancellationToken cancellationToken = CancellationToken.None; _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) - .Returns(Result.From(new UserSettingsResponse(Guid.NewGuid(), true, 48, false))); + .Returns(Result.From(new UserSettingsResponse(Guid.NewGuid(), true, 48, false, true))); // Act await _sut.ExecuteAsync(EmptyRequest.Instance, cancellationToken); @@ -104,7 +104,7 @@ public class GetUserSettingsEndpointTests operationStarted.SetResult(true); await cancellationRequested.Task; info.Arg().ThrowIfCancellationRequested(); - return Result.From(new UserSettingsResponse(Guid.NewGuid(), true, 48, false)); + return Result.From(new UserSettingsResponse(Guid.NewGuid(), true, 48, false, true)); }, info.Arg())); // Act diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs index 03c65397..5e15bdf4 100644 --- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs @@ -37,7 +37,7 @@ public class UpdateUserSettingsEndpointTests public async Task ExecuteAsync_WhenSuccessful_ShouldReturnOkResultWithUpdatedMarker() { // Arrange - UpdateUserSettingsRequest request = new(true, 48, false); + UpdateUserSettingsRequest request = new(true, 48, false, true); CancellationToken cancellationToken = CancellationToken.None; _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) .Returns(Result.Updated); @@ -54,7 +54,7 @@ public class UpdateUserSettingsEndpointTests public async Task ExecuteAsync_WhenHandlerReturnsError_ShouldReturnProblemResult() { // Arrange - UpdateUserSettingsRequest request = new(true, 0, false); + UpdateUserSettingsRequest request = new(true, 0, false, true); CancellationToken cancellationToken = CancellationToken.None; Error expectedError = Error.Validation("UserSettings.ItemsPerPageMustBeGreaterThanZero", "ItemsPerPage must be greater than zero."); _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) @@ -76,7 +76,7 @@ public class UpdateUserSettingsEndpointTests public async Task ExecuteAsync_WhenCalled_ShouldSendUpdateUserSettingsCommandToHandler() { // Arrange - UpdateUserSettingsRequest request = new(true, 24, true); + UpdateUserSettingsRequest request = new(true, 24, true, true); CancellationToken cancellationToken = CancellationToken.None; _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) .Returns(Result.Updated); @@ -89,7 +89,8 @@ public class UpdateUserSettingsEndpointTests Arg.Is(command => command.IsPaginationEnabled == request.IsPaginationEnabled && command.ItemsPerPage == request.ItemsPerPage && - command.IgnoreThePrefixForAlphaPicker == request.IgnoreThePrefixForAlphaPicker), + command.IgnoreThePrefixForAlphaPicker == request.IgnoreThePrefixForAlphaPicker && + command.IsThemeCachingEnabled == request.IsThemeCachingEnabled), Arg.Is(cancellationToken)); } @@ -111,7 +112,7 @@ public class UpdateUserSettingsEndpointTests }, info.Arg())); // Act - Task operationTask = _sut.ExecuteAsync(new UpdateUserSettingsRequest(true, 48, false), cts.Token); + Task operationTask = _sut.ExecuteAsync(new UpdateUserSettingsRequest(true, 48, false, true), cts.Token); await operationStarted.Task; cts.Cancel(); cancellationRequested.SetResult(true); diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Tools/Settings/GetUserSettings/GetUserSettingsEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Tools/Settings/GetUserSettings/GetUserSettingsEndpointTests.cs index b55cfc50..3a553dc4 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Tools/Settings/GetUserSettings/GetUserSettingsEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Tools/Settings/GetUserSettings/GetUserSettingsEndpointTests.cs @@ -3,10 +3,13 @@ using FastEndpoints; using Lumina.Presentation.Web.Common.Api; using Lumina.Presentation.Web.Common.DTO.UsersManagement; using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Common.Services; using Lumina.Presentation.Web.Core.Endpoints.Tools.Settings.GetUserSettings; using Lumina.Presentation.Web.Fixtures.Common.DTO.UsersManagement; using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Caching.Hybrid; +using Microsoft.Extensions.DependencyInjection; using NSubstitute; using System.Diagnostics.CodeAnalysis; using System.Text.Json; @@ -32,7 +35,14 @@ public class GetUserSettingsEndpointTests public GetUserSettingsEndpointTests() { _mockApiHttpClient = Substitute.For(); - _sut = Factory.Create(_mockApiHttpClient); + _sut = Factory.Create(_mockApiHttpClient, CreateThemeCachePreferenceService()); + } + + private static ThemeCachePreferenceService CreateThemeCachePreferenceService() + { + ServiceCollection services = new(); + services.AddHybridCache(); + return new ThemeCachePreferenceService(services.BuildServiceProvider().GetRequiredService()); } [Fact] diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Tools/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Tools/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs index 3691a19a..0edb17c5 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Tools/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Tools/Settings/UpdateUserSettings/UpdateUserSettingsEndpointTests.cs @@ -3,10 +3,13 @@ using FastEndpoints; using Lumina.Presentation.Web.Common.Api; using Lumina.Presentation.Web.Common.DTO.UsersManagement; using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Common.Services; using Lumina.Presentation.Web.Core.Endpoints.Tools.Settings.UpdateUserSettings; using Lumina.Presentation.Web.Fixtures.Common.DTO.UsersManagement; using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Caching.Hybrid; +using Microsoft.Extensions.DependencyInjection; using NSubstitute; using System.Diagnostics.CodeAnalysis; using System.Text.Json; @@ -32,7 +35,14 @@ public class UpdateUserSettingsEndpointTests public UpdateUserSettingsEndpointTests() { _mockApiHttpClient = Substitute.For(); - _sut = Factory.Create(_mockApiHttpClient); + _sut = Factory.Create(_mockApiHttpClient, CreateThemeCachePreferenceService()); + } + + private static ThemeCachePreferenceService CreateThemeCachePreferenceService() + { + ServiceCollection services = new(); + services.AddHybridCache(); + return new ThemeCachePreferenceService(services.BuildServiceProvider().GetRequiredService()); } [Fact]