Adds metadata aggregation to the media library enrichment job

This commit is contained in:
BinaryAlley committed 2026-08-24 14:18:40 -07:00
1 parent c82fadc7a2
commit 66871ccf62
168 files changed
+3503 -1062

No files matched your search

@@ -1,7 +1,6 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.Requests.MediaLibrary.Management;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
@@ -26,7 +25,7 @@ public class AddLibraryRequestFixture
/// <param name="coverImage">Optional. The path of the image file used as the cover.</param>
/// <param name="isEnabled">Optional. Whether the media library is enabled.</param>
/// <param name="isLocked">Optional. Whether the media library is locked.</param>
/// <param name="downloadMetadataFromWeb">Optional. Whether metadata should be downloaded from the web.</param>
/// <param name="canDownloadMetadataFromWeb">Optional. Whether metadata should be downloaded from the web.</param>
/// <param name="shouldSaveMetadataInMediaDirectories">Optional. Whether metadata should be saved in the media directories.</param>
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Optional. Whether unchanged directories should be skipped during scan.</param>
/// <returns>The created <see cref="AddLibraryRequest"/>.</returns>
@@ -37,7 +36,7 @@ public class AddLibraryRequestFixture
string? coverImage = null,
bool? isEnabled = null,
bool? isLocked = null,
bool? downloadMetadataFromWeb = null,
bool? canDownloadMetadataFromWeb = null,
bool? shouldSaveMetadataInMediaDirectories = null,
bool? shouldSkipUnchangedDirectoriesDuringScan = null)
{
@@ -48,7 +47,7 @@ public class AddLibraryRequestFixture
coverImage ?? null,
isEnabled ?? _faker.Random.Bool(),
isLocked ?? _faker.Random.Bool(),
downloadMetadataFromWeb ?? _faker.Random.Bool(),
canDownloadMetadataFromWeb ?? _faker.Random.Bool(),
shouldSaveMetadataInMediaDirectories ?? _faker.Random.Bool(),
shouldSkipUnchangedDirectoriesDuringScan ?? _faker.Random.Bool()
);
@@ -28,7 +28,7 @@ public class UpdateLibraryRequestFixture
/// <param name="coverImage">Optional. The path of the image file used as the cover.</param>
/// <param name="isEnabled">Optional. Whether the media library is enabled.</param>
/// <param name="isLocked">Optional. Whether the media library is locked.</param>
/// <param name="downloadMetadataFromWeb">Optional. Whether metadata should be downloaded from the web.</param>
/// <param name="canDownloadMetadataFromWeb">Optional. Whether metadata should be downloaded from the web.</param>
/// <param name="shouldSaveMetadataInMediaDirectories">Optional. Whether metadata should be saved in the media directories.</param>
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Optional. Whether unchanged directories should be skipped during scan.</param>
/// <returns>The created <see cref="UpdateLibraryRequest"/>.</returns>
@@ -41,7 +41,7 @@ public class UpdateLibraryRequestFixture
string? coverImage = null,
bool? isEnabled = null,
bool? isLocked = null,
bool? downloadMetadataFromWeb = null,
bool? canDownloadMetadataFromWeb = null,
bool? shouldSaveMetadataInMediaDirectories = null,
bool? shouldSkipUnchangedDirectoriesDuringScan = null)
{
@@ -54,7 +54,7 @@ public class UpdateLibraryRequestFixture
coverImage ?? null,
isEnabled ?? _faker.Random.Bool(),
isLocked ?? _faker.Random.Bool(),
downloadMetadataFromWeb ?? _faker.Random.Bool(),
canDownloadMetadataFromWeb ?? _faker.Random.Bool(),
shouldSaveMetadataInMediaDirectories ?? _faker.Random.Bool(),
shouldSkipUnchangedDirectoriesDuringScan ?? _faker.Random.Bool()
);
@@ -0,0 +1,52 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.Requests.UsersManagement.Settings;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.Requests.UsersManagement.Settings;
/// <summary>
/// Fixture class for the <see cref="UpdateUserSettingsRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class UpdateUserSettingsRequestFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="UpdateUserSettingsRequest"/>.
/// </summary>
/// <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="shouldIgnoreThePrefixForAlphaPicker">Whether the "The" prefix is ignored by the alpha picker.</param>
/// <param name="isThemeCachingEnabled">Whether the theme data served to this user is cached.</param>
/// <param name="shouldAggregateMetadataWhenMissing">Whether the metadata of the media library items is aggregated from multiple providers, when fields are missing.</param>
/// <returns>The created <see cref="UpdateUserSettingsRequest"/>.</returns>
public UpdateUserSettingsRequest Create(
bool? isPaginationEnabled = null,
int? itemsPerPage = null,
bool? shouldIgnoreThePrefixForAlphaPicker = null,
bool? isThemeCachingEnabled = null,
bool? shouldAggregateMetadataWhenMissing = null)
{
return new UpdateUserSettingsRequest(
isPaginationEnabled ?? _faker.Random.Bool(),
itemsPerPage ?? _faker.Random.Int(1, 100),
shouldIgnoreThePrefixForAlphaPicker ?? _faker.Random.Bool(),
isThemeCachingEnabled ?? _faker.Random.Bool(),
shouldAggregateMetadataWhenMissing ?? _faker.Random.Bool());
}
/// <summary>
/// Creates a list of <see cref="UpdateUserSettingsRequest"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<UpdateUserSettingsRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}