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,4 +1,5 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.Management;
using Lumina.Contracts.Requests.MediaLibrary.Management;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
@@ -12,6 +13,7 @@ namespace Lumina.Contracts.UnitTests.Requests.MediaLibrary.Management;
[ExcludeFromCodeCoverage]
public class AddLibraryRequestTests
{
private readonly AddLibraryRequestFixture _addLibraryRequestFixture = new();
private readonly JsonSerializerOptions _jsonOptions = new()
{
PropertyNameCaseInsensitive = true
@@ -21,16 +23,16 @@ public class AddLibraryRequestTests
public void RoundTrip_WhenSerializingAddLibraryRequest_ShouldPreserveValues()
{
// Arrange
AddLibraryRequest expected = new(
"Books",
"Book",
[@"C:\Media\Books"],
null,
true,
false,
true,
false,
true
AddLibraryRequest expected = _addLibraryRequestFixture.Create(
title: "Books",
libraryType: "Book",
contentLocations: [@"C:\Media\Books"],
coverImage: null,
isEnabled: true,
isLocked: false,
canDownloadMetadataFromWeb: true,
shouldSaveMetadataInMediaDirectories: false,
shouldSkipUnchangedDirectoriesDuringScan: true
);
// Act
@@ -45,20 +47,20 @@ public class AddLibraryRequestTests
public void Deconstruct_WhenCalled_ShouldReturnAllProperties()
{
// Arrange
AddLibraryRequest sut = new(
"Books",
"Book",
[@"C:\Media\Books"],
null,
true,
false,
true,
false,
true
AddLibraryRequest sut = _addLibraryRequestFixture.Create(
title: "Books",
libraryType: "Book",
contentLocations: [@"C:\Media\Books"],
coverImage: null,
isEnabled: true,
isLocked: false,
canDownloadMetadataFromWeb: true,
shouldSaveMetadataInMediaDirectories: false,
shouldSkipUnchangedDirectoriesDuringScan: true
);
// Act
(string? title, string? libraryType, string[]? contentLocations, string? coverImage, bool isEnabled, bool isLocked, bool downloadMetadataFromWeb, bool shouldSaveMetadataInMediaDirectories, bool shouldSkipUnchangedDirectoriesDuringScan) = sut;
(string? title, string? libraryType, string[]? contentLocations, string? coverImage, bool isEnabled, bool isLocked, bool canDownloadMetadataFromWeb, bool shouldSaveMetadataInMediaDirectories, bool shouldSkipUnchangedDirectoriesDuringScan) = sut;
// Assert
Assert.Equal(sut.Title, title);
@@ -67,7 +69,7 @@ public class AddLibraryRequestTests
Assert.Equal(sut.CoverImage, coverImage);
Assert.Equal(sut.IsEnabled, isEnabled);
Assert.Equal(sut.IsLocked, isLocked);
Assert.Equal(sut.DownloadMetadataFromWeb, downloadMetadataFromWeb);
Assert.Equal(sut.CanDownloadMetadataFromWeb, canDownloadMetadataFromWeb);
Assert.Equal(sut.ShouldSaveMetadataInMediaDirectories, shouldSaveMetadataInMediaDirectories);
Assert.Equal(sut.ShouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan);
}
@@ -1,4 +1,5 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.Management;
using Lumina.Contracts.Requests.MediaLibrary.Management;
using System;
using System.Diagnostics.CodeAnalysis;
@@ -13,6 +14,7 @@ namespace Lumina.Contracts.UnitTests.Requests.MediaLibrary.Management;
[ExcludeFromCodeCoverage]
public class UpdateLibraryRequestTests
{
private readonly UpdateLibraryRequestFixture _updateLibraryRequestFixture = new();
private readonly JsonSerializerOptions _jsonOptions = new()
{
PropertyNameCaseInsensitive = true
@@ -24,18 +26,18 @@ public class UpdateLibraryRequestTests
// Arrange
Guid id = Guid.NewGuid();
Guid userId = Guid.NewGuid();
UpdateLibraryRequest expected = new(
id,
userId,
"Books",
"Book",
[@"C:\Media\Books"],
null,
true,
false,
true,
false,
true
UpdateLibraryRequest expected = _updateLibraryRequestFixture.Create(
id: id,
userId: userId,
title: "Books",
libraryType: "Book",
contentLocations: [@"C:\Media\Books"],
coverImage: null,
isEnabled: true,
isLocked: false,
canDownloadMetadataFromWeb: true,
shouldSaveMetadataInMediaDirectories: false,
shouldSkipUnchangedDirectoriesDuringScan: true
);
// Act
@@ -52,22 +54,22 @@ public class UpdateLibraryRequestTests
// Arrange
Guid id = Guid.NewGuid();
Guid userId = Guid.NewGuid();
UpdateLibraryRequest sut = new(
id,
userId,
"Books",
"Book",
[@"C:\Media\Books"],
null,
true,
false,
true,
false,
true
UpdateLibraryRequest sut = _updateLibraryRequestFixture.Create(
id: id,
userId: userId,
title: "Books",
libraryType: "Book",
contentLocations: [@"C:\Media\Books"],
coverImage: null,
isEnabled: true,
isLocked: false,
canDownloadMetadataFromWeb: true,
shouldSaveMetadataInMediaDirectories: false,
shouldSkipUnchangedDirectoriesDuringScan: true
);
// Act
(Guid sutId, Guid sutUserId, string? title, string? libraryType, string[]? contentLocations, string? coverImage, bool isEnabled, bool isLocked, bool downloadMetadataFromWeb, bool shouldSaveMetadataInMediaDirectories, bool shouldSkipUnchangedDirectoriesDuringScan) = sut;
(Guid sutId, Guid sutUserId, string? title, string? libraryType, string[]? contentLocations, string? coverImage, bool isEnabled, bool isLocked, bool canDownloadMetadataFromWeb, bool shouldSaveMetadataInMediaDirectories, bool shouldSkipUnchangedDirectoriesDuringScan) = sut;
// Assert
Assert.Equal(sut.Id, sutId);
@@ -78,7 +80,7 @@ public class UpdateLibraryRequestTests
Assert.Equal(sut.CoverImage, coverImage);
Assert.Equal(sut.IsEnabled, isEnabled);
Assert.Equal(sut.IsLocked, isLocked);
Assert.Equal(sut.DownloadMetadataFromWeb, downloadMetadataFromWeb);
Assert.Equal(sut.CanDownloadMetadataFromWeb, canDownloadMetadataFromWeb);
Assert.Equal(sut.ShouldSaveMetadataInMediaDirectories, shouldSaveMetadataInMediaDirectories);
Assert.Equal(sut.ShouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan);
}
@@ -1,4 +1,5 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Fixtures.Core.Requests.UsersManagement.Settings;
using Lumina.Contracts.Requests.UsersManagement.Settings;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
@@ -12,6 +13,7 @@ namespace Lumina.Contracts.UnitTests.Requests.UsersManagement.Settings;
[ExcludeFromCodeCoverage]
public class UpdateUserSettingsRequestTests
{
private readonly UpdateUserSettingsRequestFixture _updateUserSettingsRequestFixture = new();
private readonly JsonSerializerOptions _jsonOptions = new()
{
PropertyNameCaseInsensitive = true
@@ -21,7 +23,13 @@ public class UpdateUserSettingsRequestTests
public void RoundTrip_WhenSerializingUpdateUserSettingsRequest_ShouldPreserveValues()
{
// Arrange
UpdateUserSettingsRequest expected = new(true, 50, true, true);
UpdateUserSettingsRequest expected = _updateUserSettingsRequestFixture.Create(
isPaginationEnabled: true,
itemsPerPage: 50,
shouldIgnoreThePrefixForAlphaPicker: true,
isThemeCachingEnabled: true,
shouldAggregateMetadataWhenMissing: false
);
// Act
string json = JsonSerializer.Serialize(expected, _jsonOptions);
@@ -36,15 +44,22 @@ public class UpdateUserSettingsRequestTests
public void Deconstruct_WhenCalled_ShouldReturnAllProperties()
{
// Arrange
UpdateUserSettingsRequest sut = new(false, 25, false, false);
UpdateUserSettingsRequest sut = _updateUserSettingsRequestFixture.Create(
isPaginationEnabled: false,
itemsPerPage: 25,
shouldIgnoreThePrefixForAlphaPicker: false,
isThemeCachingEnabled: false,
shouldAggregateMetadataWhenMissing: false
);
// Act
(bool isPaginationEnabled, int itemsPerPage, bool ignoreThePrefixForAlphaPicker, bool isThemeCachingEnabled) = sut;
(bool isPaginationEnabled, int itemsPerPage, bool shouldIgnoreThePrefixForAlphaPicker, bool isThemeCachingEnabled, bool shouldAggregateMetadataWhenMissing) = sut;
// Assert
Assert.Equal(sut.IsPaginationEnabled, isPaginationEnabled);
Assert.Equal(sut.ItemsPerPage, itemsPerPage);
Assert.Equal(sut.IgnoreThePrefixForAlphaPicker, ignoreThePrefixForAlphaPicker);
Assert.Equal(sut.ShouldIgnoreThePrefixForAlphaPicker, shouldIgnoreThePrefixForAlphaPicker);
Assert.Equal(sut.IsThemeCachingEnabled, isThemeCachingEnabled);
Assert.Equal(sut.ShouldAggregateMetadataWhenMissing, shouldAggregateMetadataWhenMissing);
}
}