mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 03:11:10 +00:00
Adds metadata and artwork provider configuration seeding
Seeds a disabled provider configuration for every loaded plugin supporting a library type, so that libraries list the metadata and artwork providers they can use. Configurations are seeded on startup, on library creation, and reconciled when the library type changes, and are removed only when a library or a plugin is deleted. Reads the library metadata providers through the new provider configuration store.
This commit is contained in:
1 parent
9ae8c0c394
commit
00dcf3d471
20 files changed
+1139
-27
No files matched your search
+26
@@ -39,4 +39,30 @@ public interface IArtworkProviderConfigurationRepository : IRepository<LibraryAr
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
|
||||
Task<Result<Updated>> UpsertAsync(LibraryArtworkProviderConfigurationEntity configuration, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes all the artwork provider configurations of the media library identified by <paramref name="libraryId"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">The Id of the media library whose artwork provider configurations are deleted.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
|
||||
Task<Result<Deleted>> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes all the artwork provider configurations referencing the plugin identified by <paramref name="pluginId"/>.
|
||||
/// </summary>
|
||||
/// <param name="pluginId">The Id of the plugin whose artwork provider configurations are deleted.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
|
||||
Task<Result<Deleted>> DeleteByPluginIdAsync(Guid pluginId, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the artwork provider configurations of the media library identified by <paramref name="libraryId"/> that reference
|
||||
/// one of the plugins identified by <paramref name="pluginIds"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">The Id of the media library whose artwork provider configurations are deleted.</param>
|
||||
/// <param name="pluginIds">The Ids of the plugins whose configurations of the media library are deleted.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
|
||||
Task<Result<Deleted>> DeleteByLibraryIdAndPluginIdsAsync(Guid libraryId, IEnumerable<Guid> pluginIds, CancellationToken cancellationToken);
|
||||
}
|
||||
+26
@@ -39,4 +39,30 @@ public interface ILibraryMetadataProviderConfigurationRepository : IRepository<L
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
|
||||
Task<Result<Updated>> UpsertAsync(LibraryMetadataProviderConfigurationEntity configuration, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes all the metadata provider configurations of the media library identified by <paramref name="libraryId"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">The Id of the media library whose metadata provider configurations are deleted.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
|
||||
Task<Result<Deleted>> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes all the metadata provider configurations referencing the plugin identified by <paramref name="pluginId"/>.
|
||||
/// </summary>
|
||||
/// <param name="pluginId">The Id of the plugin whose metadata provider configurations are deleted.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
|
||||
Task<Result<Deleted>> DeleteByPluginIdAsync(Guid pluginId, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the metadata provider configurations of the media library identified by <paramref name="libraryId"/> that reference
|
||||
/// one of the plugins identified by <paramref name="pluginIds"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">The Id of the media library whose metadata provider configurations are deleted.</param>
|
||||
/// <param name="pluginIds">The Ids of the plugins whose configurations of the media library are deleted.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
|
||||
Task<Result<Deleted>> DeleteByLibraryIdAndPluginIdsAsync(Guid libraryId, IEnumerable<Guid> pluginIds, CancellationToken cancellationToken);
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.DataAccess.Entities.Plugins;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Infrastructure.Plugins;
|
||||
|
||||
/// <summary>
|
||||
/// Store of the metadata and artwork provider configurations of the media libraries.
|
||||
/// </summary>
|
||||
public interface IMediaLibraryProviderConfigurationStore
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the metadata provider configurations of the media library identified by <paramref name="libraryId"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">The Id of the media library whose metadata provider configurations are retrieved.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> containing either the configurations, or an error.</returns>
|
||||
Task<Result<IReadOnlyList<LibraryMetadataProviderConfigurationEntity>>> GetConfigurationsAsync(Guid libraryId, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a disabled provider configuration for every loaded plugin that supports the provided library type and has no
|
||||
/// configuration yet for the media library identified by <paramref name="libraryId"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">The Id of the media library whose provider configurations are ensured.</param>
|
||||
/// <param name="libraryType">The type of the media library, used to determine the plugins whose providers apply.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
|
||||
Task<Result<Success>> EnsureProviderConfigurationsAsync(Guid libraryId, LibraryType libraryType, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Replaces the provider configurations of the media library identified by <paramref name="libraryId"/> so that they
|
||||
/// match the plugins supporting the provided library type.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">The Id of the media library whose provider configurations are reconciled.</param>
|
||||
/// <param name="libraryType">The type of the media library, used to determine the plugins whose providers apply.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
|
||||
Task<Result<Success>> ReconcileProviderConfigurationsAsync(Guid libraryId, LibraryType libraryType, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes all the provider configurations of the media library identified by <paramref name="libraryId"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">The Id of the media library whose provider configurations are deleted.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
|
||||
Task<Result<Deleted>> RemoveProviderConfigurationsForLibraryAsync(Guid libraryId, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes all the provider configurations referencing the plugin identified by <paramref name="pluginId"/>.
|
||||
/// </summary>
|
||||
/// <param name="pluginId">The Id of the plugin whose provider configurations are deleted.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
|
||||
Task<Result<Deleted>> RemoveProviderConfigurationsAsync(Guid pluginId, CancellationToken cancellationToken);
|
||||
}
|
||||
+12
-2
@@ -5,6 +5,7 @@ using Lumina.Application.Common.DataAccess.UoW;
|
||||
using Lumina.Application.Common.DomainEvents;
|
||||
using Lumina.Application.Common.Infrastructure.Authentication;
|
||||
using Lumina.Application.Common.Infrastructure.Authorization;
|
||||
using Lumina.Application.Common.Infrastructure.Plugins;
|
||||
using Lumina.Application.Common.Infrastructure.Validation;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.Management;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.Management;
|
||||
@@ -37,6 +38,7 @@ public class AddLibraryCommandHandler : ICommandHandler<AddLibraryCommand, Resul
|
||||
private readonly IDomainEventsQueue _domainEventsQueue;
|
||||
private readonly IEnvironmentContext _environmentContext;
|
||||
private readonly IAuthorizationService _authorizationService;
|
||||
private readonly IMediaLibraryProviderConfigurationStore _providerConfigurationStore;
|
||||
private readonly IValidator<AddLibraryCommand> _validator;
|
||||
|
||||
/// <summary>
|
||||
@@ -46,13 +48,15 @@ public class AddLibraryCommandHandler : ICommandHandler<AddLibraryCommand, Resul
|
||||
/// <param name="currentUserService">Injected service to retrieve the current user information.</param>
|
||||
/// <param name="domainEventsQueue">Injected service for the queue of domain events.</param>
|
||||
/// <param name="environmentContext">Injected facade service for environment contextual services.</param>
|
||||
/// <param name="providerConfigurationStore">Injected store of the provider configurations of the media libraries.</param>
|
||||
/// <param name="unitOfWork">Injected unit of work for interacting with the data access layer repositories.</param>
|
||||
/// <param name="validator">Injected validator for application validation rules.</param>
|
||||
public AddLibraryCommandHandler(
|
||||
IAuthorizationService authorizationService,
|
||||
ICurrentUserService currentUserService,
|
||||
ICurrentUserService currentUserService,
|
||||
IDomainEventsQueue domainEventsQueue,
|
||||
IEnvironmentContext environmentContext,
|
||||
IMediaLibraryProviderConfigurationStore providerConfigurationStore,
|
||||
IUnitOfWork unitOfWork,
|
||||
IValidator<AddLibraryCommand> validator)
|
||||
{
|
||||
@@ -61,6 +65,7 @@ public class AddLibraryCommandHandler : ICommandHandler<AddLibraryCommand, Resul
|
||||
_domainEventsQueue = domainEventsQueue;
|
||||
_environmentContext = environmentContext;
|
||||
_authorizationService = authorizationService;
|
||||
_providerConfigurationStore = providerConfigurationStore;
|
||||
_validator = validator;
|
||||
}
|
||||
|
||||
@@ -123,10 +128,15 @@ public class AddLibraryCommandHandler : ICommandHandler<AddLibraryCommand, Resul
|
||||
|
||||
// convert the domain library entity to a repository library entity
|
||||
LibraryEntity persistenceLibrary = createLibraryResult.Value.ToRepositoryEntity();
|
||||
// insert the repository entity and save changes
|
||||
// insert the repository entity, seed the provider configurations of the new library so that it lists the plugins
|
||||
// providing metadata or artwork for its type, and save the changes
|
||||
Result<Created> insertLibraryResult = await _unitOfWork.LibraryRepository.InsertAsync(persistenceLibrary, cancellationToken).ConfigureAwait(false);
|
||||
if (insertLibraryResult.IsFailure)
|
||||
return insertLibraryResult.Errors;
|
||||
Result<Success> ensureProviderConfigurationsResult = await _providerConfigurationStore.EnsureProviderConfigurationsAsync(
|
||||
createLibraryResult.Value.Id.Value, Enum.Parse<LibraryType>(command.LibraryType!), cancellationToken).ConfigureAwait(false);
|
||||
if (ensureProviderConfigurationsResult.IsFailure)
|
||||
return ensureProviderConfigurationsResult.Errors;
|
||||
await _unitOfWork.SaveChangesAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// retrieve the newly saved media library from the persistence medium and return it
|
||||
|
||||
+9
-1
@@ -8,6 +8,7 @@ using Lumina.Application.Common.DomainEvents;
|
||||
using Lumina.Application.Common.Infrastructure.Authentication;
|
||||
using Lumina.Application.Common.Infrastructure.Authorization;
|
||||
using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwnership;
|
||||
using Lumina.Application.Common.Infrastructure.Plugins;
|
||||
using Lumina.Application.Common.Infrastructure.Validation;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.Management;
|
||||
using Lumina.Domain.Common.Events;
|
||||
@@ -31,6 +32,7 @@ public class DeleteLibraryCommandHandler : ICommandHandler<DeleteLibraryCommand,
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
private readonly IAuthorizationService _authorizationService;
|
||||
private readonly IDomainEventsQueue _domainEventsQueue;
|
||||
private readonly IMediaLibraryProviderConfigurationStore _providerConfigurationStore;
|
||||
private readonly IValidator<DeleteLibraryCommand> _validator;
|
||||
|
||||
/// <summary>
|
||||
@@ -39,18 +41,21 @@ public class DeleteLibraryCommandHandler : ICommandHandler<DeleteLibraryCommand,
|
||||
/// <param name="authorizationService">Injected service for authorization related functionality.</param>
|
||||
/// <param name="currentUserService">Injected service to retrieve the current user information.</param>
|
||||
/// <param name="domainEventsQueue">Injected service for the queue of domain events.</param>
|
||||
/// <param name="providerConfigurationStore">Injected store of the provider configurations of the media libraries.</param>
|
||||
/// <param name="unitOfWork">Injected unit of work for interacting with the data access layer repositories.</param>
|
||||
/// <param name="validator">Injected validator for application validation rules.</param>
|
||||
public DeleteLibraryCommandHandler(
|
||||
IAuthorizationService authorizationService,
|
||||
ICurrentUserService currentUserService,
|
||||
IDomainEventsQueue domainEventsQueue,
|
||||
IMediaLibraryProviderConfigurationStore providerConfigurationStore,
|
||||
IUnitOfWork unitOfWork,
|
||||
IValidator<DeleteLibraryCommand> validator)
|
||||
{
|
||||
_authorizationService = authorizationService;
|
||||
_currentUserService = currentUserService;
|
||||
_domainEventsQueue = domainEventsQueue;
|
||||
_providerConfigurationStore = providerConfigurationStore;
|
||||
_unitOfWork = unitOfWork;
|
||||
_validator = validator;
|
||||
}
|
||||
@@ -100,7 +105,10 @@ public class DeleteLibraryCommandHandler : ICommandHandler<DeleteLibraryCommand,
|
||||
foreach (IDomainEvent domainEvent in createLibraryResult.Value.GetDomainEvents())
|
||||
_domainEventsQueue.Enqueue(domainEvent);
|
||||
|
||||
// perform the deletion
|
||||
// remove the provider configurations of the library, so that they are not orphaned, and delete the library
|
||||
Result<Deleted> removeProviderConfigurationsResult = await _providerConfigurationStore.RemoveProviderConfigurationsForLibraryAsync(command.Id, cancellationToken).ConfigureAwait(false);
|
||||
if (removeProviderConfigurationsResult.IsFailure)
|
||||
return removeProviderConfigurationsResult.Errors;
|
||||
Result<Deleted> deletePersistenceLibraryResult = await _unitOfWork.LibraryRepository.DeleteByIdAsync(command.Id, cancellationToken).ConfigureAwait(false);
|
||||
if (deletePersistenceLibraryResult.IsFailure)
|
||||
return deletePersistenceLibraryResult.Errors;
|
||||
|
||||
+16
-3
@@ -6,6 +6,7 @@ using Lumina.Application.Common.DomainEvents;
|
||||
using Lumina.Application.Common.Infrastructure.Authentication;
|
||||
using Lumina.Application.Common.Infrastructure.Authorization;
|
||||
using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwnership;
|
||||
using Lumina.Application.Common.Infrastructure.Plugins;
|
||||
using Lumina.Application.Common.Infrastructure.Validation;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.Management;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.Management;
|
||||
@@ -41,6 +42,7 @@ public class UpdateLibraryCommandHandler : ICommandHandler<UpdateLibraryCommand,
|
||||
private readonly IAuthorizationService _authorizationService;
|
||||
private readonly IDomainEventsQueue _domainEventsQueue;
|
||||
private readonly IEnvironmentContext _environmentContext;
|
||||
private readonly IMediaLibraryProviderConfigurationStore _providerConfigurationStore;
|
||||
private readonly IValidator<UpdateLibraryCommand> _validator;
|
||||
|
||||
/// <summary>
|
||||
@@ -50,13 +52,15 @@ public class UpdateLibraryCommandHandler : ICommandHandler<UpdateLibraryCommand,
|
||||
/// <param name="currentUserService">Injected service to retrieve the current user information.</param>
|
||||
/// <param name="domainEventsQueue">Injected service for the queue of domain events.</param>
|
||||
/// <param name="environmentContext">Injected facade service for environment contextual services.</param>
|
||||
/// <param name="providerConfigurationStore">Injected store of the provider configurations of the media libraries.</param>
|
||||
/// <param name="unitOfWork">Injected unit of work for interacting with the data access layer repositories.</param>
|
||||
/// <param name="validator">Injected validator for application validation rules.</param>
|
||||
public UpdateLibraryCommandHandler(
|
||||
IAuthorizationService authorizationService,
|
||||
IAuthorizationService authorizationService,
|
||||
ICurrentUserService currentUserService,
|
||||
IDomainEventsQueue domainEventsQueue,
|
||||
IEnvironmentContext environmentContext,
|
||||
IMediaLibraryProviderConfigurationStore providerConfigurationStore,
|
||||
IUnitOfWork unitOfWork,
|
||||
IValidator<UpdateLibraryCommand> validator)
|
||||
{
|
||||
@@ -65,6 +69,7 @@ public class UpdateLibraryCommandHandler : ICommandHandler<UpdateLibraryCommand,
|
||||
_unitOfWork = unitOfWork;
|
||||
_domainEventsQueue = domainEventsQueue;
|
||||
_environmentContext = environmentContext;
|
||||
_providerConfigurationStore = providerConfigurationStore;
|
||||
_validator = validator;
|
||||
}
|
||||
|
||||
@@ -117,11 +122,12 @@ public class UpdateLibraryCommandHandler : ICommandHandler<UpdateLibraryCommand,
|
||||
return ApplicationErrors.Authorization.NotAuthorized;
|
||||
|
||||
// create a domain library object
|
||||
LibraryType newLibraryType = Enum.Parse<LibraryType>(command.LibraryType!);
|
||||
Result<Library> createLibraryResult = Library.Create(
|
||||
LibraryId.Create(command.Id),
|
||||
UserId.Create(command.OwnerId),
|
||||
command.Title!,
|
||||
Enum.Parse<LibraryType>(command.LibraryType!),
|
||||
newLibraryType,
|
||||
command.ContentLocations!,
|
||||
command.CoverImage,
|
||||
command.IsEnabled,
|
||||
@@ -136,10 +142,17 @@ public class UpdateLibraryCommandHandler : ICommandHandler<UpdateLibraryCommand,
|
||||
// convert the domain library entity to a repository library entity
|
||||
LibraryEntity persistenceLibrary = createLibraryResult.Value.ToRepositoryEntity();
|
||||
|
||||
// update the repository entity and save changes
|
||||
// update the repository entity, and when the library type changed, reconcile the provider configurations so that
|
||||
// they match the plugins supporting the new type, and save the changes
|
||||
Result<Updated> updateLibraryResult = await _unitOfWork.LibraryRepository.UpdateAsync(persistenceLibrary, cancellationToken).ConfigureAwait(false);
|
||||
if (updateLibraryResult.IsFailure)
|
||||
return updateLibraryResult.Errors;
|
||||
if (getLibraryResult.Value.LibraryType != newLibraryType)
|
||||
{
|
||||
Result<Success> reconcileResult = await _providerConfigurationStore.ReconcileProviderConfigurationsAsync(command.Id, newLibraryType, cancellationToken).ConfigureAwait(false);
|
||||
if (reconcileResult.IsFailure)
|
||||
return reconcileResult.Errors;
|
||||
}
|
||||
await _unitOfWork.SaveChangesAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// retrieve the updated media library from the persistence medium and return it
|
||||
|
||||
+6
-2
@@ -5,6 +5,7 @@ using Lumina.Application.Common.DataAccess.UoW;
|
||||
using Lumina.Application.Common.Infrastructure.Authentication;
|
||||
using Lumina.Application.Common.Infrastructure.Authorization;
|
||||
using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwnership;
|
||||
using Lumina.Application.Common.Infrastructure.Plugins;
|
||||
using Lumina.Application.Common.Infrastructure.Validation;
|
||||
using Lumina.Application.Common.Mapping.Plugins;
|
||||
using Lumina.Contracts.Responses.Plugins;
|
||||
@@ -27,6 +28,7 @@ public class GetLibraryMetadataProvidersQueryHandler : IQueryHandler<GetLibraryM
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
private readonly IAuthorizationService _authorizationService;
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
private readonly IMediaLibraryProviderConfigurationStore _providerConfigurationStore;
|
||||
private readonly IValidator<GetLibraryMetadataProvidersQuery> _validator;
|
||||
|
||||
/// <summary>
|
||||
@@ -34,12 +36,14 @@ public class GetLibraryMetadataProvidersQueryHandler : IQueryHandler<GetLibraryM
|
||||
/// </summary>
|
||||
/// <param name="authorizationService">Injected service for authorization related functionality.</param>
|
||||
/// <param name="currentUserService">Injected service to retrieve the current user information.</param>
|
||||
/// <param name="providerConfigurationStore">Injected store of the provider configurations of the media libraries.</param>
|
||||
/// <param name="unitOfWork">Injected unit of work for interacting with the data access layer repositories.</param>
|
||||
/// <param name="validator">Injected validator for application validation rules.</param>
|
||||
public GetLibraryMetadataProvidersQueryHandler(IAuthorizationService authorizationService, ICurrentUserService currentUserService, IUnitOfWork unitOfWork, IValidator<GetLibraryMetadataProvidersQuery> validator)
|
||||
public GetLibraryMetadataProvidersQueryHandler(IAuthorizationService authorizationService, ICurrentUserService currentUserService, IMediaLibraryProviderConfigurationStore providerConfigurationStore, IUnitOfWork unitOfWork, IValidator<GetLibraryMetadataProvidersQuery> validator)
|
||||
{
|
||||
_authorizationService = authorizationService;
|
||||
_currentUserService = currentUserService;
|
||||
_providerConfigurationStore = providerConfigurationStore;
|
||||
_unitOfWork = unitOfWork;
|
||||
_validator = validator;
|
||||
}
|
||||
@@ -70,7 +74,7 @@ public class GetLibraryMetadataProvidersQueryHandler : IQueryHandler<GetLibraryM
|
||||
if (!canAccessLibrary)
|
||||
return ApplicationErrors.Authorization.NotAuthorized;
|
||||
|
||||
Result<IReadOnlyList<LibraryMetadataProviderConfigurationEntity>> getConfigurationsResult = await _unitOfWork.LibraryMetadataProviderConfigurationRepository.GetByLibraryIdAsync(query.LibraryId, cancellationToken).ConfigureAwait(false);
|
||||
Result<IReadOnlyList<LibraryMetadataProviderConfigurationEntity>> getConfigurationsResult = await _providerConfigurationStore.GetConfigurationsAsync(query.LibraryId, cancellationToken).ConfigureAwait(false);
|
||||
if (getConfigurationsResult.IsFailure)
|
||||
return getConfigurationsResult.Errors;
|
||||
|
||||
|
||||
Reference in new issue
Block a user