Improves the plugin system documentation, tests and conventions

- Documents the book metadata DTOs and the Book aggregate constructor parameters
- References ADR-0006 in the scan snapshot repository remarks, explaining the Dapper choice
- Extracts shared plugin entity fixtures and uses them in the plugin and metadata provider tests
- Moves PluginLoadResult to the Common DTO models, renaming it PluginLoadResultDto
- Replaces the duplicate Contracts plugin setting type with the shared kernel enum
- Removes the generated plugin view Designer file and its project wiring
- Drops redundant braces in the plugin repositories
This commit is contained in:
BinaryAlley committed 2026-08-12 13:58:47 -07:00
1 parent 42566dcf06
commit 3653ff5bd7
25 files changed
+168 -321

No files matched your search

@@ -18,6 +18,11 @@ namespace Lumina.DataAccess.Core.Repositories.Libraries;
/// <summary>
/// Repository for media library scan snapshots.
/// </summary>
/// <remarks>
/// The bulk snapshot operations are executed with parameterized raw SQL through Dapper on a dedicated database connection, instead of Entity Framework Core,
/// because the change tracker is not suited for the multi-row inserts, upserts, key-set paginated reads and bulk deletes that the media library scan pipeline performs at scale.
/// See docs/technical/architecture/architecture-knowledge-management/architecture-decision-log/architecture-decision-record-0006.md for details.
/// </remarks>
internal sealed class LibraryScanSnapshotRepository : ILibraryScanSnapshotRepository
{
private readonly LuminaDbContext _luminaDbContext;
@@ -66,9 +66,7 @@ internal sealed class LibraryMetadataProviderConfigurationRepository : ILibraryM
LibraryMetadataProviderConfigurationEntity? existingConfiguration = await _luminaDbContext.LibraryMetadataProviderConfigurations
.FirstOrDefaultAsync(repositoryConfiguration => repositoryConfiguration.LibraryId == configuration.LibraryId && repositoryConfiguration.PluginId == configuration.PluginId, cancellationToken).ConfigureAwait(false);
if (existingConfiguration is null)
{
_luminaDbContext.LibraryMetadataProviderConfigurations.Add(configuration);
}
else
{
// update only the mutable fields, preserving the Id of the existing configuration
@@ -63,9 +63,7 @@ internal sealed class PluginRepository : IPluginRepository
PluginEntity? existingPlugin = await _luminaDbContext.Plugins
.FirstOrDefaultAsync(repositoryPlugin => repositoryPlugin.Id == plugin.Id, cancellationToken).ConfigureAwait(false);
if (existingPlugin is null)
{
_luminaDbContext.Plugins.Add(plugin);
}
else
{
// update only the detection fields, preserving the stored settings and creation date