Merge branch 'feature/add-metadata-aggregation' into feature/add-artwork-provider-and-metadata-aggregation

This commit is contained in:
BinaryAlley committed 2026-08-24 22:53:57 -07:00
commit b47588cf83
168 files changed
+3503 -1062

No files matched your search

@@ -25,5 +25,5 @@ public record LibraryFilterDto : BaseFilterDto
/// <summary>
/// Whether the leading "The " prefix of a title should be ignored when computing the alpha key, or not.
/// </summary>
public bool IgnoreThePrefixForAlphaPicker { get; init; }
public bool ShouldIgnoreThePrefixForAlphaPicker { get; init; }
}
@@ -63,7 +63,7 @@ public class LibraryEntity : IStorageEntity, IAuditableEntity
/// <summary>
/// Gets whether this media library should update the metadata of its elements from the web, or not.
/// </summary>
public bool DownloadMetadataFromWeb { get; init; }
public bool CanDownloadMetadataFromWeb { get; init; }
/// <summary>
/// Gets whether this media library should copy the downloaded metadata into the media library content locations, or not.
@@ -35,13 +35,18 @@ public class UserSettingsEntity : IStorageEntity, IAuditableEntity
/// <summary>
/// Gets or sets whether the "The" prefix of library item titles is ignored by the alpha picker, or not.
/// </summary>
public bool IgnoreThePrefixForAlphaPicker { get; set; }
public bool ShouldIgnoreThePrefixForAlphaPicker { get; set; }
/// <summary>
/// Gets or sets whether the theme data served to this user is cached, or not.
/// </summary>
public bool IsThemeCachingEnabled { get; set; } = true;
/// <summary>
/// Gets or sets whether the metadata of the media library items is aggregated from multiple providers, when fields are missing, or not.
/// </summary>
public bool ShouldAggregateMetadataWhenMissing { get; set; }
/// <summary>
/// Gets or sets the time and date when the entity was added.
/// </summary>
@@ -71,6 +71,11 @@ public interface IUnitOfWork
/// </summary>
ILibraryMetadataProviderConfigurationRepository LibraryMetadataProviderConfigurationRepository { get; }
/// <summary>
/// Gets the library artwork provider configuration repository.
/// </summary>
IArtworkProviderConfigurationRepository ArtworkProviderConfigurationRepository { get; }
/// <summary>
/// Gets the plugin repository.
/// </summary>
@@ -97,6 +102,11 @@ public interface IUnitOfWork
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
Task SaveChangesAsync(CancellationToken cancellationToken);
/// <summary>
/// Detaches all the entities tracked by the unit of work, freeing the memory they occupy.
/// </summary>
void ClearTrackedEntities();
/// <summary>
/// Begins a new database transaction.
/// </summary>
@@ -21,4 +21,9 @@ public class MediaSettingsDto
/// Gets or sets the directory where media library files are stored.
/// </summary>
public required string LibrariesDirectory { get; init; }
/// <summary>
/// Gets or sets the directory where the media item files are stored.
/// </summary>
public required string BooksDirectory { get; init; }
}
@@ -1,9 +1,6 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Core.MediaLibrary.Management.Commands.AddLibrary;
using Lumina.Application.Core.MediaLibrary.WrittenContentLibrary.BooksLibrary.Books.Commands.AddBook;
using Lumina.Contracts.Requests.MediaLibrary.Management;
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using System;
#endregion
namespace Lumina.Application.Common.Mapping.MediaLibrary.Management;
@@ -27,7 +24,7 @@ public static class AddMediaLibraryRequestMapping
request.CoverImage,
request.IsEnabled,
request.IsLocked,
request.DownloadMetadataFromWeb,
request.CanDownloadMetadataFromWeb,
request.ShouldSaveMetadataInMediaDirectories,
request.ShouldSkipUnchangedDirectoriesDuringScan
);
@@ -1,7 +1,7 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Primitives;
using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management;
using Lumina.Contracts.Responses.MediaLibrary.Management;
using Lumina.Domain.Common.Primitives;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
@@ -29,11 +29,11 @@ public static class LibraryEntityMapping
repositoryEntity.UserId,
repositoryEntity.Title,
repositoryEntity.LibraryType,
repositoryEntity.ContentLocations.Select(location => location.Path).ToList(),
[.. repositoryEntity.ContentLocations.Select(location => location.Path)],
repositoryEntity.CoverImage,
repositoryEntity.IsEnabled,
repositoryEntity.IsLocked,
repositoryEntity.DownloadMetadataFromWeb,
repositoryEntity.CanDownloadMetadataFromWeb,
repositoryEntity.ShouldSaveMetadataInMediaDirectories,
repositoryEntity.ShouldSkipUnchangedDirectoriesDuringScan,
repositoryEntity.CreatedOnUtc,
@@ -59,10 +59,10 @@ public static class LibraryEntityMapping
repositoryEntity.CoverImage,
repositoryEntity.IsEnabled,
repositoryEntity.IsLocked,
repositoryEntity.DownloadMetadataFromWeb,
repositoryEntity.CanDownloadMetadataFromWeb,
repositoryEntity.ShouldSaveMetadataInMediaDirectories,
repositoryEntity.ShouldSkipUnchangedDirectoriesDuringScan,
repositoryEntity.LibraryScans.Select(libraryScan => ScanId.Create(libraryScan.Id)).ToList()
[.. repositoryEntity.LibraryScans.Select(libraryScan => ScanId.Create(libraryScan.Id))]
);
}
@@ -25,14 +25,14 @@ public static class LibraryMapping
Title = domainEntity.Title,
LibraryType = domainEntity.LibraryType,
UserId = domainEntity.UserId.Value,
ContentLocations = domainEntity.ContentLocations.Select(path => new LibraryContentLocationEntity() { Path = path.Path }).ToList(),
ContentLocations = [.. domainEntity.ContentLocations.Select(path => new LibraryContentLocationEntity() { Path = path.Path })],
CoverImage = domainEntity.CoverImage,
IsEnabled = domainEntity.IsEnabled,
IsLocked = domainEntity.IsLocked,
DownloadMetadataFromWeb = domainEntity.DownloadMetadataFromWeb,
CanDownloadMetadataFromWeb = domainEntity.CanDownloadMetadataFromWeb,
ShouldSaveMetadataInMediaDirectories = domainEntity.ShouldSaveMetadataInMediaDirectories,
ShouldSkipUnchangedDirectoriesDuringScan = domainEntity.ShouldSkipUnchangedDirectoriesDuringScan,
LibraryScans = domainEntity.ScanIds.Select(scanId => new LibraryScanEntity()
LibraryScans = [.. domainEntity.ScanIds.Select(scanId => new LibraryScanEntity()
{
Id = scanId.Value,
LibraryId = domainEntity.Id.Value,
@@ -43,7 +43,7 @@ public static class LibraryMapping
CreatedBy = default,
CreatedOnUtc = default,
UpdatedBy = default,
}).ToList(),
})],
CreatedOnUtc = domainEntity.CreatedOnUtc,
CreatedBy = Guid.Empty,
UpdatedOnUtc = domainEntity.UpdatedOnUtc.HasValue ? domainEntity.UpdatedOnUtc : null,
@@ -1,7 +1,6 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Core.MediaLibrary.Management.Commands.UpdateLibrary;
using Lumina.Contracts.Requests.MediaLibrary.Management;
using System;
#endregion
namespace Lumina.Application.Common.Mapping.MediaLibrary.Management;
@@ -27,7 +26,7 @@ public static class UpdateLibraryRequestMapping
request.CoverImage,
request.IsEnabled,
request.IsLocked,
request.DownloadMetadataFromWeb,
request.CanDownloadMetadataFromWeb,
request.ShouldSaveMetadataInMediaDirectories,
request.ShouldSkipUnchangedDirectoriesDuringScan
);
@@ -20,7 +20,9 @@ public static class UpdateUserSettingsRequestMapping
return new UpdateUserSettingsCommand(
request.IsPaginationEnabled,
request.ItemsPerPage,
request.IgnoreThePrefixForAlphaPicker,
request.IsThemeCachingEnabled);
request.ShouldIgnoreThePrefixForAlphaPicker,
request.IsThemeCachingEnabled,
request.ShouldAggregateMetadataWhenMissing
);
}
}
@@ -1,7 +1,7 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Primitives;
using Lumina.Application.Common.DataAccess.Entities.UsersManagement;
using Lumina.Contracts.Responses.UsersManagement.Settings;
using Lumina.Domain.Common.Primitives;
using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserAggregate.ValueObjects;
using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserSettingsAggregate;
using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserSettingsAggregate.ValueObjects;
@@ -28,8 +28,10 @@ public static class UserSettingsEntityMapping
UserId.Create(repositoryEntity.UserId),
repositoryEntity.IsPaginationEnabled,
repositoryEntity.ItemsPerPage,
repositoryEntity.IgnoreThePrefixForAlphaPicker,
repositoryEntity.IsThemeCachingEnabled);
repositoryEntity.ShouldIgnoreThePrefixForAlphaPicker,
repositoryEntity.IsThemeCachingEnabled,
repositoryEntity.ShouldAggregateMetadataWhenMissing
);
}
/// <summary>
@@ -43,7 +45,9 @@ public static class UserSettingsEntityMapping
repositoryEntity.UserId,
repositoryEntity.IsPaginationEnabled,
repositoryEntity.ItemsPerPage,
repositoryEntity.IgnoreThePrefixForAlphaPicker,
repositoryEntity.IsThemeCachingEnabled);
repositoryEntity.ShouldIgnoreThePrefixForAlphaPicker,
repositoryEntity.IsThemeCachingEnabled,
repositoryEntity.ShouldAggregateMetadataWhenMissing
);
}
}
@@ -24,8 +24,9 @@ public static class UserSettingsMapping
UserId = domainEntity.UserId.Value,
IsPaginationEnabled = domainEntity.IsPaginationEnabled,
ItemsPerPage = domainEntity.ItemsPerPage,
IgnoreThePrefixForAlphaPicker = domainEntity.IgnoreThePrefixForAlphaPicker,
IsThemeCachingEnabled = domainEntity.IsThemeCachingEnabled
ShouldIgnoreThePrefixForAlphaPicker = domainEntity.ShouldIgnoreThePrefixForAlphaPicker,
IsThemeCachingEnabled = domainEntity.IsThemeCachingEnabled,
ShouldAggregateMetadataWhenMissing = domainEntity.ShouldAggregateMetadataWhenMissing
};
}
@@ -40,7 +41,9 @@ public static class UserSettingsMapping
domainEntity.UserId.Value,
domainEntity.IsPaginationEnabled,
domainEntity.ItemsPerPage,
domainEntity.IgnoreThePrefixForAlphaPicker,
domainEntity.IsThemeCachingEnabled);
domainEntity.ShouldIgnoreThePrefixForAlphaPicker,
domainEntity.IsThemeCachingEnabled,
domainEntity.ShouldAggregateMetadataWhenMissing
);
}
}