Adds a theme caching toggle to the user settings

This commit is contained in:
BinaryAlley committed 2026-08-21 04:04:54 -07:00
1 parent 60b551558f
commit 3da7167538
43 files changed
+1611 -56

No files matched your search

@@ -23,13 +23,15 @@ public class UserSettingsEntityFixture
/// <param name="isPaginationEnabled">Optional. Whether pagination is enabled for the user, or not.</param>
/// <param name="itemsPerPage">Optional. The number of library items displayed per page when pagination is enabled.</param>
/// <param name="ignoreThePrefixForAlphaPicker">Optional. Whether the "The" prefix is ignored by the alpha picker, or not.</param>
/// <param name="isThemeCachingEnabled">Optional. Whether the theme data served to this user is cached, or not.</param>
/// <returns>The created user settings entity.</returns>
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<UserSettingsEntity>()
.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();
}
@@ -20,17 +20,20 @@ public class UpdateUserSettingsCommandFixture
/// <param name="isPaginationEnabled">Optional. Whether pagination is enabled for the user, or not.</param>
/// <param name="itemsPerPage">Optional. The number of library items displayed per page when pagination is enabled.</param>
/// <param name="ignoreThePrefixForAlphaPicker">Optional. Whether the "The" prefix is ignored by the alpha picker, or not.</param>
/// <param name="isThemeCachingEnabled">Optional. Whether the theme data served to this user is cached, or not.</param>
/// <returns>The created command.</returns>
public UpdateUserSettingsCommand Create(
bool? isPaginationEnabled = null,
int? itemsPerPage = null,
bool? ignoreThePrefixForAlphaPicker = null)
bool? ignoreThePrefixForAlphaPicker = null,
bool? isThemeCachingEnabled = null)
{
return new Faker<UpdateUserSettingsCommand>()
.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();
}
@@ -23,18 +23,21 @@ public class UserSettingsFixture
/// <param name="isPaginationEnabled">Whether pagination is enabled for the user.</param>
/// <param name="itemsPerPage">The number of library items displayed per page when pagination is enabled.</param>
/// <param name="ignoreThePrefixForAlphaPicker">Whether the "The" prefix of library item titles is ignored by the alpha picker.</param>
/// <param name="isThemeCachingEnabled">Whether the theme data served to this user is cached.</param>
/// <returns>The created <see cref="UserSettings"/>.</returns>
public UserSettings Create(
Guid? userId = null,
bool isPaginationEnabled = true,
int itemsPerPage = 48,
bool ignoreThePrefixForAlphaPicker = false)
bool ignoreThePrefixForAlphaPicker = false,
bool isThemeCachingEnabled = true)
{
Result<UserSettings> settings = UserSettings.Create(
userId is null ? UserId.CreateUnique() : UserId.Create(userId.Value),
isPaginationEnabled,
itemsPerPage,
ignoreThePrefixForAlphaPicker);
ignoreThePrefixForAlphaPicker,
isThemeCachingEnabled);
return settings.Value;
}