diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/Common/Actions/IDeleteAllRepositoryAction.cs b/src/Lumina.Application/Common/DataAccess/Repositories/Common/Actions/IDeleteAllRepositoryAction.cs index e72502cd..323a7b89 100644 --- a/src/Lumina.Application/Common/DataAccess/Repositories/Common/Actions/IDeleteAllRepositoryAction.cs +++ b/src/Lumina.Application/Common/DataAccess/Repositories/Common/Actions/IDeleteAllRepositoryAction.cs @@ -13,6 +13,6 @@ public interface IDeleteAllRepositoryAction /// /// Deletes all entities from the storage medium. /// - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. Task> DeleteAllAsync(); } \ No newline at end of file diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/Common/Actions/IDeleteByIdRepositoryAction.cs b/src/Lumina.Application/Common/DataAccess/Repositories/Common/Actions/IDeleteByIdRepositoryAction.cs index 7ff2e3a5..eeb1168e 100644 --- a/src/Lumina.Application/Common/DataAccess/Repositories/Common/Actions/IDeleteByIdRepositoryAction.cs +++ b/src/Lumina.Application/Common/DataAccess/Repositories/Common/Actions/IDeleteByIdRepositoryAction.cs @@ -17,6 +17,6 @@ public interface IDeleteByIdRepositoryAction where TId : notnull /// /// The id of the element to be deleted. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. Task> DeleteByIdAsync(TId id, CancellationToken cancellationToken); } \ No newline at end of file diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/Common/Actions/IInsertRepositoryAction.cs b/src/Lumina.Application/Common/DataAccess/Repositories/Common/Actions/IInsertRepositoryAction.cs index dfe43dbd..4315e6d8 100644 --- a/src/Lumina.Application/Common/DataAccess/Repositories/Common/Actions/IInsertRepositoryAction.cs +++ b/src/Lumina.Application/Common/DataAccess/Repositories/Common/Actions/IInsertRepositoryAction.cs @@ -18,6 +18,6 @@ public interface IInsertRepositoryAction where TModel : IStorageEntity /// /// The element to be saved. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. Task> InsertAsync(TModel data, CancellationToken cancellationToken); } \ No newline at end of file diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/Common/Actions/IUpdateRepositoryAction.cs b/src/Lumina.Application/Common/DataAccess/Repositories/Common/Actions/IUpdateRepositoryAction.cs index 06d860c1..7ea288a8 100644 --- a/src/Lumina.Application/Common/DataAccess/Repositories/Common/Actions/IUpdateRepositoryAction.cs +++ b/src/Lumina.Application/Common/DataAccess/Repositories/Common/Actions/IUpdateRepositoryAction.cs @@ -18,6 +18,6 @@ public interface IUpdateRepositoryAction where TModel : IStorageEntity /// /// The element that will be updated. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. Task> UpdateAsync(TModel data, CancellationToken cancellationToken); } \ No newline at end of file diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/MediaLibrary/ILibraryRepository.cs b/src/Lumina.Application/Common/DataAccess/Repositories/MediaLibrary/ILibraryRepository.cs index 67025750..0d6528b6 100644 --- a/src/Lumina.Application/Common/DataAccess/Repositories/MediaLibrary/ILibraryRepository.cs +++ b/src/Lumina.Application/Common/DataAccess/Repositories/MediaLibrary/ILibraryRepository.cs @@ -12,7 +12,9 @@ namespace Lumina.Application.Common.DataAccess.Repositories.MediaLibrary; /// public interface ILibraryRepository : IRepository, IGetByIdRepositoryAction, + IGetAllRepositoryAction, IInsertRepositoryAction, - IUpdateRepositoryAction + IUpdateRepositoryAction, + IDeleteByIdRepositoryAction { } diff --git a/src/Lumina.Application/Common/DataAccess/Seed/IDataSeedService.cs b/src/Lumina.Application/Common/DataAccess/Seed/IDataSeedService.cs index c0d45e65..63a9ca8d 100644 --- a/src/Lumina.Application/Common/DataAccess/Seed/IDataSeedService.cs +++ b/src/Lumina.Application/Common/DataAccess/Seed/IDataSeedService.cs @@ -17,7 +17,7 @@ public interface IDataSeedService /// /// The Id of the admin admin user who will own these permissions. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. Task> SetDefaultAuthorizationPermissionsAsync(Guid adminId, CancellationToken cancellationToken); /// @@ -25,7 +25,7 @@ public interface IDataSeedService /// /// The Id of the admin user for whom roles will be set. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. Task> SetDefaultAuthorizationRolesAsync(Guid userId, CancellationToken cancellationToken); /// @@ -33,7 +33,7 @@ public interface IDataSeedService /// /// The Id of the admin user to receive admin role permissions. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. Task> SetAdminRolePermissionsAsync(Guid userId, CancellationToken cancellationToken); /// @@ -41,6 +41,6 @@ public interface IDataSeedService /// /// The Id of the admin user to receive the admin role. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. Task> SetAdminRoleToAdministratorAccount(Guid userId, CancellationToken cancellationToken); } diff --git a/src/Lumina.Application/Common/DomainEvents/DomainEventsQueue.cs b/src/Lumina.Application/Common/DomainEvents/DomainEventsQueue.cs index 9dbd62c1..41c7fa6a 100644 --- a/src/Lumina.Application/Common/DomainEvents/DomainEventsQueue.cs +++ b/src/Lumina.Application/Common/DomainEvents/DomainEventsQueue.cs @@ -26,7 +26,7 @@ public class DomainEventsQueue : IDomainEventsQueue /// /// When this method returns, contains the domain event removed from the queue, or the default value of if the queue is empty. /// - /// if a domain event was successfully dequeued, otherwise. + /// if a domain event was successfuly dequeued, otherwise. public bool TryDequeue(out IDomainEvent domainEvent) { return _queue.TryDequeue(out domainEvent!); diff --git a/src/Lumina.Application/Common/DomainEvents/IDomainEventsQueue.cs b/src/Lumina.Application/Common/DomainEvents/IDomainEventsQueue.cs index cd802424..bba874e1 100644 --- a/src/Lumina.Application/Common/DomainEvents/IDomainEventsQueue.cs +++ b/src/Lumina.Application/Common/DomainEvents/IDomainEventsQueue.cs @@ -20,6 +20,6 @@ public interface IDomainEventsQueue /// /// When this method returns, contains the domain event removed from the queue, or the default value of if the queue is empty. /// - /// if a domain event was successfully dequeued, otherwise. + /// if a domain event was successfuly dequeued, otherwise. bool TryDequeue(out IDomainEvent domainEvent); } diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/DeleteLibraryRequestMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/DeleteLibraryRequestMapping.cs new file mode 100644 index 00000000..f2cbeb95 --- /dev/null +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/DeleteLibraryRequestMapping.cs @@ -0,0 +1,24 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Core.MediaLibrary.Management.Commands.DeleteLibrary; +using Lumina.Contracts.Requests.MediaLibrary.Management; +#endregion + +namespace Lumina.Application.Common.Mapping.MediaLibrary.Management; + +/// +/// Extension methods for converting . +/// +public static class DeleteLibraryRequestMapping +{ + /// + /// Converts to . + /// + /// The request to be converted. + /// The converted command. + public static DeleteLibraryCommand ToCommand(this DeleteLibraryRequest request) + { + return new DeleteLibraryCommand( + request.Id + ); + } +} diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/GetLibraryRequestMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/GetLibraryRequestMapping.cs index 6122e0b5..7afed744 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/GetLibraryRequestMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/GetLibraryRequestMapping.cs @@ -1,5 +1,5 @@ #region ========================================================================= USING ===================================================================================== -using Lumina.Application.Core.MediaLibrary.Management.Queries; +using Lumina.Application.Core.MediaLibrary.Management.Queries.GetLibrary; using Lumina.Contracts.Requests.MediaLibrary.Management; using System; #endregion @@ -15,13 +15,11 @@ public static class GetLibraryRequestMapping /// Converts to . /// /// The request to be converted. - /// The Id of the user requesting the media library. /// The converted query. - public static GetLibraryQuery ToQuery(this GetLibraryRequest request, Guid userId) + public static GetLibraryQuery ToQuery(this GetLibraryRequest request) { return new GetLibraryQuery( - request.Id, - userId + request.Id ); } } diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryEntityMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryEntityMapping.cs index 8b18f905..430ec2fb 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryEntityMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryEntityMapping.cs @@ -1,6 +1,9 @@ #region ========================================================================= USING ===================================================================================== +using ErrorOr; using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management; using Lumina.Contracts.Responses.MediaLibrary.Management; +using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate; +using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects; using System.Linq; #endregion @@ -29,4 +32,21 @@ public static class LibraryEntityMapping repositoryEntity.UpdatedOnUtc ); } + + /// + /// Converts to . + /// + /// The repository entity to be converted. + /// The converted domain entity. + public static ErrorOr ToDomainEntity(this LibraryEntity repositoryEntity) + { + return Library.Create( + LibraryId.Create(repositoryEntity.Id), + repositoryEntity.UserId, + repositoryEntity.Title, + repositoryEntity.LibraryType, + repositoryEntity.ContentLocations.Select(contentLocation => contentLocation.Path), + repositoryEntity.CoverImage + ); + } } diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookEntityMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookEntityMapping.cs index a1635e1a..5e915398 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookEntityMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookEntityMapping.cs @@ -30,7 +30,7 @@ public static class BookEntityMapping /// /// The repository entity to be converted. /// - /// An containing either a successfully converted , or an error message. + /// An containing either a successfuly converted , or an error message. /// public static ErrorOr ToDomainEntity(this BookEntity repositoryEntity) { @@ -137,7 +137,7 @@ public static class BookEntityMapping /// The repository entities to be converted. /// The converted domain entities. /// - /// An colection of containing either successfully converted , or error messages. + /// An colection of containing either successfuly converted , or error messages. /// public static IEnumerable> ToDomainEntities(this IEnumerable repositoryEntities) { diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Common/IsbnDtoMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Common/IsbnDtoMapping.cs index 407edcb1..ec4a3f66 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Common/IsbnDtoMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Common/IsbnDtoMapping.cs @@ -19,7 +19,7 @@ public static class IsbnDtoMapping /// /// The DTO to be converted. /// - /// An containing either a successfully converted , or an error message. + /// An containing either a successfuly converted , or an error message. /// public static ErrorOr ToDomainEntity(this IsbnDto dto) { diff --git a/src/Lumina.Application/Core/Admin/Authorization/Roles/Commands/AddRole/AddRoleCommandHandler.cs b/src/Lumina.Application/Core/Admin/Authorization/Roles/Commands/AddRole/AddRoleCommandHandler.cs index 74c13ceb..d16f561b 100644 --- a/src/Lumina.Application/Core/Admin/Authorization/Roles/Commands/AddRole/AddRoleCommandHandler.cs +++ b/src/Lumina.Application/Core/Admin/Authorization/Roles/Commands/AddRole/AddRoleCommandHandler.cs @@ -44,7 +44,7 @@ public class AddRoleCommandHandler : IRequestHandlerThe request to be handled. /// Cancellation token that can be used to stop the execution. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public async ValueTask> Handle(AddRoleCommand request, CancellationToken cancellationToken) { diff --git a/src/Lumina.Application/Core/Admin/Authorization/Roles/Commands/DeleteRole/DeleteRoleCommandHandler.cs b/src/Lumina.Application/Core/Admin/Authorization/Roles/Commands/DeleteRole/DeleteRoleCommandHandler.cs index 7ff3ea27..33c8daa8 100644 --- a/src/Lumina.Application/Core/Admin/Authorization/Roles/Commands/DeleteRole/DeleteRoleCommandHandler.cs +++ b/src/Lumina.Application/Core/Admin/Authorization/Roles/Commands/DeleteRole/DeleteRoleCommandHandler.cs @@ -46,7 +46,7 @@ public class DeleteRoleCommandHandler : IRequestHandlerThe request to be handled. /// Cancellation token that can be used to stop the execution. /// - /// An containing either a successfully deleted , or an error message. + /// An containing either a successfuly deleted , or an error message. /// public async ValueTask> Handle(DeleteRoleCommand request, CancellationToken cancellationToken) { diff --git a/src/Lumina.Application/Core/Admin/Authorization/Roles/Commands/UpdateRole/UpdateRoleCommandHandler.cs b/src/Lumina.Application/Core/Admin/Authorization/Roles/Commands/UpdateRole/UpdateRoleCommandHandler.cs index 11ebe913..2d7c0fb7 100644 --- a/src/Lumina.Application/Core/Admin/Authorization/Roles/Commands/UpdateRole/UpdateRoleCommandHandler.cs +++ b/src/Lumina.Application/Core/Admin/Authorization/Roles/Commands/UpdateRole/UpdateRoleCommandHandler.cs @@ -44,7 +44,7 @@ public class UpdateRoleCommandHandler : IRequestHandlerThe request to be handled. /// Cancellation token that can be used to stop the execution. /// - /// An containing either a successfully updated , or an error message. + /// An containing either a successfuly updated , or an error message. /// public async ValueTask> Handle(UpdateRoleCommand request, CancellationToken cancellationToken) { diff --git a/src/Lumina.Application/Core/Maintenance/ApplicationSetup/Commands/SetupApplication/SetupApplicationCommandHandler.cs b/src/Lumina.Application/Core/Maintenance/ApplicationSetup/Commands/SetupApplication/SetupApplicationCommandHandler.cs index c6d80a8a..3ca602e9 100644 --- a/src/Lumina.Application/Core/Maintenance/ApplicationSetup/Commands/SetupApplication/SetupApplicationCommandHandler.cs +++ b/src/Lumina.Application/Core/Maintenance/ApplicationSetup/Commands/SetupApplication/SetupApplicationCommandHandler.cs @@ -66,7 +66,7 @@ public class SetupApplicationCommandHandler : IRequestHandlerThe request to be handled. /// Cancellation token that can be used to stop the execution. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public async ValueTask> Handle(SetupApplicationCommand request, CancellationToken cancellationToken) { diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandHandler.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandHandler.cs index b4a8a417..823008d8 100644 --- a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandHandler.cs +++ b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandHandler.cs @@ -64,7 +64,7 @@ public class AddLibraryCommandHandler : IRequestHandlerThe request to be handled. /// Cancellation token that can be used to stop the execution. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public async ValueTask> Handle(AddLibraryCommand request, CancellationToken cancellationToken) { @@ -93,7 +93,7 @@ public class AddLibraryCommandHandler : IRequestHandler +/// Command for deleting a media library by its Id. +/// +/// The Id of the media library to delete. +[DebuggerDisplay("Id: {Id}")] +public record DeleteLibraryCommand( + Guid Id +) : IRequest>; diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/DeleteLibrary/DeleteLibraryCommandHandler.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/DeleteLibrary/DeleteLibraryCommandHandler.cs new file mode 100644 index 00000000..462787c8 --- /dev/null +++ b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/DeleteLibrary/DeleteLibraryCommandHandler.cs @@ -0,0 +1,96 @@ +#region ========================================================================= USING ===================================================================================== +using ErrorOr; +using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management; +using Lumina.Application.Common.DataAccess.Repositories.MediaLibrary; +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.Mapping.MediaLibrary.Management; +using Lumina.Contracts.Responses.MediaLibrary.Management; +using Lumina.Domain.Common.Events; +using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate; +using Mediator; +using System.Threading; +using System.Threading.Tasks; +using ApplicationErrors = Lumina.Application.Common.Errors.Errors; +using DomainErrors = Lumina.Domain.Common.Errors.Errors; +#endregion + +namespace Lumina.Application.Core.MediaLibrary.Management.Commands.DeleteLibrary; + +/// +/// Handler for the command to delete a library by its Id. +/// +public class DeleteLibraryCommandHandler : IRequestHandler> +{ + private readonly IUnitOfWork _unitOfWork; + private readonly ICurrentUserService _currentUserService; + private readonly IAuthorizationService _authorizationService; + private readonly IDomainEventsQueue _domainEventsQueue; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for authorization related functionality. + /// Injected service to retrieve the current user information. + /// Injected service for the queue of domain events. + /// Injected unit of work for interacting with the data access layer repositories. + public DeleteLibraryCommandHandler( + IAuthorizationService authorizationService, + ICurrentUserService currentUserService, + IDomainEventsQueue domainEventsQueue, + IUnitOfWork unitOfWork) + { + _authorizationService = authorizationService; + _currentUserService = currentUserService; + _domainEventsQueue = domainEventsQueue; + _unitOfWork = unitOfWork; + } + + /// + /// Handles the command to delete a library by its Id. + /// + /// The request to be handled. + /// Cancellation token that can be used to stop the execution. + /// + /// An containing either a successfuly created , or an error message. + /// + public async ValueTask> Handle(DeleteLibraryCommand request, CancellationToken cancellationToken) + { + // get the library with the specified id from the repository + ILibraryRepository libraryRepository = _unitOfWork.GetRepository(); + ErrorOr getLibraryResult = await libraryRepository.GetByIdAsync(request.Id, cancellationToken).ConfigureAwait(false); + if (getLibraryResult.IsError) + return getLibraryResult.Errors; + else if (getLibraryResult.Value is null) + return DomainErrors.Library.LibraryNotFound; + + // if the user that wants to delete the library is not an Admin or is not the owner of the library, they do not have the right to delete it + if (getLibraryResult.Value.UserId != _currentUserService.UserId || + !await _authorizationService.IsInRoleAsync(_currentUserService.UserId!.Value, "Admin", cancellationToken).ConfigureAwait(false)) + return ApplicationErrors.Authorization.NotAuthorized; + + // create a domain library object + ErrorOr createLibraryResult = getLibraryResult.Value.ToDomainEntity(); + if (createLibraryResult.IsError) + return createLibraryResult.Errors; + + // delete the domain aggregate + ErrorOr deleteDomainLibraryResult = createLibraryResult.Value.Delete(); + if (deleteDomainLibraryResult.IsError) + return deleteDomainLibraryResult.Errors; + + // queue any domain events + foreach (IDomainEvent domainEvent in createLibraryResult.Value.PopDomainEvents()) + _domainEventsQueue.Enqueue(domainEvent); + + // perform the deletion + ErrorOr deletePersistenceLibraryResult = await libraryRepository.DeleteByIdAsync(request.Id, cancellationToken).ConfigureAwait(false); + if (deletePersistenceLibraryResult.IsError) + return deletePersistenceLibraryResult.Errors; + await _unitOfWork.SaveChangesAsync(cancellationToken).ConfigureAwait(false); + + return deletePersistenceLibraryResult; + } +} diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/DeleteLibrary/DeleteLibraryCommandValidator.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/DeleteLibrary/DeleteLibraryCommandValidator.cs new file mode 100644 index 00000000..6402b54e --- /dev/null +++ b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/DeleteLibrary/DeleteLibraryCommandValidator.cs @@ -0,0 +1,23 @@ +#region ========================================================================= USING ===================================================================================== +using FluentValidation; +using Lumina.Domain.Common.Errors; +using System; +#endregion + +namespace Lumina.Application.Core.MediaLibrary.Management.Commands.DeleteLibrary; + +/// +/// Validates the needed validation rules for . +/// +public class DeleteLibraryCommandValidator : AbstractValidator +{ + /// + /// Initializes a new instance of the class. + /// + public DeleteLibraryCommandValidator() + { + RuleFor(x => x.Id) + .NotEmpty().WithMessage(Errors.Library.LibraryIdCannotBeEmpty.Description) + .Must(id => id != Guid.Empty).WithMessage(Errors.Library.LibraryIdCannotBeEmpty.Description); + } +} diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandHandler.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandHandler.cs index b590d6d6..41cae421 100644 --- a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandHandler.cs +++ b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandHandler.cs @@ -65,7 +65,7 @@ public class UpdateLibraryCommandHandler : IRequestHandlerThe request to be handled. /// Cancellation token that can be used to stop the execution. /// - /// An containing either a successfully updated , or an error message. + /// An containing either a successfuly updated , or an error message. /// public async ValueTask> Handle(UpdateLibraryCommand request, CancellationToken cancellationToken) { @@ -93,7 +93,7 @@ public class UpdateLibraryCommandHandler : IRequestHandler +/// Handler for the event raised when a media library is deleted. +/// +public class LibraryDeletedDomainEventHandler : INotificationHandler +{ + private readonly IEnvironmentContext _environmentContext; + private readonly IPathService _pathService; + private readonly MediaSettingsModel _mediaSettingsModel; + + /// + /// Initializes a new instance of the class. + /// + /// Injected facade service for environment contextual services. + /// Injected service for handling file system paths. + /// Injected service for retrieving . + public LibraryDeletedDomainEventHandler(IEnvironmentContext environmentContext, IPathService pathService, IOptions mediaSettingsModelOptions) + { + _environmentContext = environmentContext; + _pathService = pathService; + _mediaSettingsModel = mediaSettingsModelOptions.Value; + } + + /// + /// Handles the event raised when a media library is deleted. + /// + /// The domain event to be handled. + /// Cancellation token that can be used to stop the execution. + public ValueTask Handle(LibraryDeletedDomainEvent domainEvent, CancellationToken cancellationToken) + { + // delete the media library directory in the internal location for media library files + ErrorOr libraryPathResult = GetLibraryPath(domainEvent.Library.Id.Value); + if (libraryPathResult.IsError) + throw new EventualConsistencyException(libraryPathResult.FirstError, libraryPathResult.Errors); + + ErrorOr newLibraryPathIdResult = FileSystemPathId.Create(libraryPathResult.Value); + if (newLibraryPathIdResult.IsError) + throw new EventualConsistencyException(newLibraryPathIdResult.FirstError, newLibraryPathIdResult.Errors); + + ErrorOr deleteLibraryDirectoryResult = _environmentContext.DirectoryProviderService.DeleteDirectory(newLibraryPathIdResult.Value); + if (deleteLibraryDirectoryResult.IsError) + throw new EventualConsistencyException(deleteLibraryDirectoryResult.FirstError, deleteLibraryDirectoryResult.Errors); + + return ValueTask.CompletedTask; + } + + /// + /// Gets the file system path of a media library identified by . + /// + /// The id of the media library for which to regtrieve the file system path. + /// + /// An containing either the file system path of the media library, or an error message. + /// + private ErrorOr GetLibraryPath(Guid libraryId) + { + // root directory for media + ErrorOr rootPathResult = _pathService.CombinePath(AppContext.BaseDirectory, _mediaSettingsModel.RootDirectory); + if (rootPathResult.IsError) + return rootPathResult.Errors; + + // libraries directory + ErrorOr librariesPathResult = _pathService.CombinePath(rootPathResult.Value, _mediaSettingsModel.LibrariesDirectory); + if (librariesPathResult.IsError) + return librariesPathResult.Errors; + + // this new particular library' directory + ErrorOr libraryPathResult = _pathService.CombinePath(librariesPathResult.Value, libraryId.ToString()); + if (libraryPathResult.IsError) + return libraryPathResult.Errors; + return libraryPathResult.Value; + } +} diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibrarySavedDomainEventHandler.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibrarySavedDomainEventHandler.cs index 3aa16913..b4898213 100644 --- a/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibrarySavedDomainEventHandler.cs +++ b/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibrarySavedDomainEventHandler.cs @@ -33,7 +33,7 @@ public class LibrarySavedDomainEventHandler : INotificationHandler - /// + /// Initializes a new instance of the class. /// /// Injected unit of work for interacting with the data access layer repositories. /// Injected facade service for environment contextual services. @@ -192,7 +192,7 @@ public class LibrarySavedDomainEventHandler : INotificationHandler diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibraries/GetLibrariesQuery.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibraries/GetLibrariesQuery.cs new file mode 100644 index 00000000..f774aefb --- /dev/null +++ b/src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibraries/GetLibrariesQuery.cs @@ -0,0 +1,12 @@ +#region ========================================================================= USING ===================================================================================== +using ErrorOr; +using Lumina.Contracts.Responses.MediaLibrary.Management; +using Mediator; +#endregion + +namespace Lumina.Application.Core.MediaLibrary.Management.Queries.GetLibraries; + +/// +/// Query for getting the list of media libraries. +/// +public record GetLibrariesQuery : IRequest>; diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibraries/GetLibrariesQueryHandler.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibraries/GetLibrariesQueryHandler.cs new file mode 100644 index 00000000..b59303db --- /dev/null +++ b/src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibraries/GetLibrariesQueryHandler.cs @@ -0,0 +1,73 @@ +#region ========================================================================= USING ===================================================================================== +using ErrorOr; +using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management; +using Lumina.Application.Common.DataAccess.Repositories.MediaLibrary; +using Lumina.Application.Common.DataAccess.UoW; +using Lumina.Application.Common.Infrastructure.Authentication; +using Lumina.Application.Common.Infrastructure.Authorization; +using Lumina.Application.Common.Mapping.MediaLibrary.Management; +using Lumina.Contracts.Responses.MediaLibrary.Management; +using Mediator; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Application.Core.MediaLibrary.Management.Queries.GetLibraries; + +/// +/// Handler for the query to authenticate an account. +/// +public class GetLibrariesQueryHandler : IRequestHandler> +{ + private readonly IUnitOfWork _unitOfWork; + private readonly ICurrentUserService _currentUserService; + private readonly IAuthorizationService _authorizationService; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for authorization related functionality. + /// Injected service to retrieve the current user information. + /// Injected unit of work for interacting with the data access layer repositories. + public GetLibrariesQueryHandler( + IAuthorizationService authorizationService, + ICurrentUserService currentUserService, + IUnitOfWork unitOfWork) + { + _authorizationService = authorizationService; + _currentUserService = currentUserService; + _unitOfWork = unitOfWork; + } + + /// + /// Handles the query to authenticate an account. + /// + /// The request to be handled. + /// Cancellation token that can be used to stop the execution. + /// + /// An containing either a successfuly created , or an error message. + /// + public async ValueTask> Handle(GetLibrariesQuery request, CancellationToken cancellationToken) + { + // get the library with the specified id from the repository + ILibraryRepository libraryRepository = _unitOfWork.GetRepository(); + ErrorOr> getLibrariesResult = await libraryRepository.GetAllAsync(cancellationToken).ConfigureAwait(false); + if (getLibrariesResult.IsError) + return getLibrariesResult.Errors; + + // admins can see all libraries + if (await _authorizationService.IsInRoleAsync(_currentUserService.UserId!.Value, "Admin", cancellationToken).ConfigureAwait(false)) + return ErrorOrFactory.From(getLibrariesResult.Value.Select(library => library.ToResponse()).ToArray()); + else + { + // for regular users, only take the libraries that belong to them + LibraryResponse[] userLibraries = getLibrariesResult.Value + .Where(library => library.UserId == _currentUserService.UserId) + .Select(library => library.ToResponse()).ToArray(); + + return ErrorOrFactory.From(userLibraries); + } + } +} diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibraryQuery.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibrary/GetLibraryQuery.cs similarity index 84% rename from src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibraryQuery.cs rename to src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibrary/GetLibraryQuery.cs index c734e7ad..fb365a19 100644 --- a/src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibraryQuery.cs +++ b/src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibrary/GetLibraryQuery.cs @@ -6,15 +6,13 @@ using System; using System.Diagnostics; #endregion -namespace Lumina.Application.Core.MediaLibrary.Management.Queries; +namespace Lumina.Application.Core.MediaLibrary.Management.Queries.GetLibrary; /// /// Query for getting a media library by its Id. /// /// The Id of the media library to get. -/// The Id of the user requesting the media library. [DebuggerDisplay("Id: {Id}")] public record GetLibraryQuery( - Guid Id, - Guid UserId + Guid Id ) : IRequest>; diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibraryQueryHandler.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibrary/GetLibraryQueryHandler.cs similarity index 64% rename from src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibraryQueryHandler.cs rename to src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibrary/GetLibraryQueryHandler.cs index 91ee0193..0e726d85 100644 --- a/src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibraryQueryHandler.cs +++ b/src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibrary/GetLibraryQueryHandler.cs @@ -3,8 +3,11 @@ using ErrorOr; using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management; using Lumina.Application.Common.DataAccess.Repositories.MediaLibrary; using Lumina.Application.Common.DataAccess.UoW; +using Lumina.Application.Common.Infrastructure.Authentication; +using Lumina.Application.Common.Infrastructure.Authorization; using Lumina.Application.Common.Mapping.MediaLibrary.Management; using Lumina.Contracts.Responses.MediaLibrary.Management; +using Lumina.Domain.Common.Enums.Authorization; using Mediator; using System.Threading; using System.Threading.Tasks; @@ -12,44 +15,57 @@ using ApplicationErrors = Lumina.Application.Common.Errors.Errors; using DomainErrors = Lumina.Domain.Common.Errors.Errors; #endregion -namespace Lumina.Application.Core.MediaLibrary.Management.Queries; +namespace Lumina.Application.Core.MediaLibrary.Management.Queries.GetLibrary; /// -/// Handler for the query to authenticate an account. +/// Handler for the query to get a library by its Id. /// public class GetLibraryQueryHandler : IRequestHandler> { private readonly IUnitOfWork _unitOfWork; + private readonly ICurrentUserService _currentUserService; + private readonly IAuthorizationService _authorizationService; /// /// Initializes a new instance of the class. /// + /// Injected service for authorization related functionality. + /// Injected service to retrieve the current user information. /// Injected unit of work for interacting with the data access layer repositories. public GetLibraryQueryHandler( + IAuthorizationService authorizationService, + ICurrentUserService currentUserService, IUnitOfWork unitOfWork) { + _authorizationService = authorizationService; + _currentUserService = currentUserService; _unitOfWork = unitOfWork; } /// - /// Handles the query to authenticate an account. + /// Handles the query to get a library by its Id. /// /// The request to be handled. /// Cancellation token that can be used to stop the execution. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public async ValueTask> Handle(GetLibraryQuery request, CancellationToken cancellationToken) { + // get the library with the specified id from the repository ILibraryRepository libraryRepository = _unitOfWork.GetRepository(); ErrorOr getLibraryResult = await libraryRepository.GetByIdAsync(request.Id, cancellationToken).ConfigureAwait(false); if (getLibraryResult.IsError) return getLibraryResult.Errors; else if (getLibraryResult.Value is null) return DomainErrors.Library.LibraryNotFound; + // if the user that requested the library is not an Admin or is not the owner of the library, they do not have the right to view it - if (getLibraryResult.Value.UserId != request.UserId) // TODO: after implementing the Admin role, add that permission check here too + if (getLibraryResult.Value.UserId != _currentUserService.UserId || + (!await _authorizationService.IsInRoleAsync(_currentUserService.UserId!.Value, "Admin", cancellationToken).ConfigureAwait(false) && + !await _authorizationService.HasPermissionAsync(_currentUserService.UserId!.Value, AuthorizationPermission.CanCreateLibraries, cancellationToken))) return ApplicationErrors.Authorization.NotAuthorized; + return getLibraryResult.Value.ToResponse(); } } diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibraryQueryValidator.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibrary/GetLibraryQueryValidator.cs similarity index 80% rename from src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibraryQueryValidator.cs rename to src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibrary/GetLibraryQueryValidator.cs index 972d942a..b74b396c 100644 --- a/src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibraryQueryValidator.cs +++ b/src/Lumina.Application/Core/MediaLibrary/Management/Queries/GetLibrary/GetLibraryQueryValidator.cs @@ -4,7 +4,7 @@ using Lumina.Domain.Common.Errors; using System; #endregion -namespace Lumina.Application.Core.MediaLibrary.Management.Queries; +namespace Lumina.Application.Core.MediaLibrary.Management.Queries.GetLibrary; /// /// Validates the needed validation rules for . @@ -19,9 +19,5 @@ public class GetLibraryQueryValidator : AbstractValidator RuleFor(x => x.Id) .NotEmpty().WithMessage(Errors.Library.LibraryIdCannotBeEmpty.Description) .Must(id => id != Guid.Empty).WithMessage(Errors.Library.LibraryIdCannotBeEmpty.Description); - - RuleFor(x => x.UserId) - .NotEmpty().WithMessage(Errors.Users.UserIdCannotBeEmpty.Description) - .Must(id => id != Guid.Empty).WithMessage(Errors.Users.UserIdCannotBeEmpty.Description); } } diff --git a/src/Lumina.Application/Core/MediaLibrary/WrittenContentLibrary/BooksLibrary/Books/Commands/AddBook/AddBookCommandHandler.cs b/src/Lumina.Application/Core/MediaLibrary/WrittenContentLibrary/BooksLibrary/Books/Commands/AddBook/AddBookCommandHandler.cs index 1e73d67a..93bb2331 100644 --- a/src/Lumina.Application/Core/MediaLibrary/WrittenContentLibrary/BooksLibrary/Books/Commands/AddBook/AddBookCommandHandler.cs +++ b/src/Lumina.Application/Core/MediaLibrary/WrittenContentLibrary/BooksLibrary/Books/Commands/AddBook/AddBookCommandHandler.cs @@ -45,7 +45,7 @@ public class AddBookCommandHandler : IRequestHandlerThe request to be handled. /// Cancellation token that can be used to stop the execution. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public async ValueTask> Handle(AddBookCommand request, CancellationToken cancellationToken) { diff --git a/src/Lumina.Application/Core/UsersManagement/Authentication/Commands/ChangePassword/ChangePasswordCommandHandler.cs b/src/Lumina.Application/Core/UsersManagement/Authentication/Commands/ChangePassword/ChangePasswordCommandHandler.cs index ceda4423..95b06c11 100644 --- a/src/Lumina.Application/Core/UsersManagement/Authentication/Commands/ChangePassword/ChangePasswordCommandHandler.cs +++ b/src/Lumina.Application/Core/UsersManagement/Authentication/Commands/ChangePassword/ChangePasswordCommandHandler.cs @@ -41,7 +41,7 @@ public class ChangePasswordCommandHandler : IRequestHandlerThe request to be handled. /// Cancellation token that can be used to stop the execution. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public async ValueTask> Handle(ChangePasswordCommand request, CancellationToken cancellationToken) { diff --git a/src/Lumina.Application/Core/UsersManagement/Authentication/Commands/RecoverPassword/RecoverPasswordCommandHandler.cs b/src/Lumina.Application/Core/UsersManagement/Authentication/Commands/RecoverPassword/RecoverPasswordCommandHandler.cs index 35f02923..799440d5 100644 --- a/src/Lumina.Application/Core/UsersManagement/Authentication/Commands/RecoverPassword/RecoverPasswordCommandHandler.cs +++ b/src/Lumina.Application/Core/UsersManagement/Authentication/Commands/RecoverPassword/RecoverPasswordCommandHandler.cs @@ -50,7 +50,7 @@ public class RecoverPasswordCommandHandler : IRequestHandlerThe request to be handled. /// Cancellation token that can be used to stop the execution. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public async ValueTask> Handle(RecoverPasswordCommand request, CancellationToken cancellationToken) { diff --git a/src/Lumina.Application/Core/UsersManagement/Authentication/Commands/RegisterUser/RegisterUserCommandHandler.cs b/src/Lumina.Application/Core/UsersManagement/Authentication/Commands/RegisterUser/RegisterUserCommandHandler.cs index d265f111..6829651c 100644 --- a/src/Lumina.Application/Core/UsersManagement/Authentication/Commands/RegisterUser/RegisterUserCommandHandler.cs +++ b/src/Lumina.Application/Core/UsersManagement/Authentication/Commands/RegisterUser/RegisterUserCommandHandler.cs @@ -59,7 +59,7 @@ public class RegisterUserCommandHandler : IRequestHandlerThe request to be handled. /// Cancellation token that can be used to stop the execution. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public async ValueTask> Handle(RegisterUserCommand request, CancellationToken cancellationToken) { diff --git a/src/Lumina.Application/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryHandler.cs b/src/Lumina.Application/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryHandler.cs index 38242f44..9d9dd177 100644 --- a/src/Lumina.Application/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryHandler.cs +++ b/src/Lumina.Application/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryHandler.cs @@ -59,7 +59,7 @@ public class LoginUserQueryHandler : IRequestHandlerThe request to be handled. /// Cancellation token that can be used to stop the execution. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public async ValueTask> Handle(LoginUserQuery request, CancellationToken cancellationToken) { diff --git a/src/Lumina.Application/Core/UsersManagement/Authorization/Commands/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsCommandHandler.cs b/src/Lumina.Application/Core/UsersManagement/Authorization/Commands/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsCommandHandler.cs index fdd726ef..a745c4b1 100644 --- a/src/Lumina.Application/Core/UsersManagement/Authorization/Commands/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsCommandHandler.cs +++ b/src/Lumina.Application/Core/UsersManagement/Authorization/Commands/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsCommandHandler.cs @@ -48,7 +48,7 @@ public class UpdateUserRoleAndPermissionsCommandHandler : IRequestHandlerThe request to be handled. /// Cancellation token that can be used to stop the execution. /// - /// An containing either a successfully updated , or an error message. + /// An containing either a successfuly updated , or an error message. /// public async ValueTask> Handle(UpdateUserRoleAndPermissionsCommand request, CancellationToken cancellationToken) { diff --git a/src/Lumina.Contracts/Requests/MediaLibrary/Management/DeleteLibraryRequest.cs b/src/Lumina.Contracts/Requests/MediaLibrary/Management/DeleteLibraryRequest.cs new file mode 100644 index 00000000..d5ea42af --- /dev/null +++ b/src/Lumina.Contracts/Requests/MediaLibrary/Management/DeleteLibraryRequest.cs @@ -0,0 +1,15 @@ +#region ========================================================================= USING ===================================================================================== +using System; +using System.Diagnostics; +#endregion + +namespace Lumina.Contracts.Requests.MediaLibrary.Management; + +/// +/// Represents a request to delete a media library by its Id. +/// +/// The Id of the media library. Required. +[DebuggerDisplay("Id: {Id}")] +public record DeleteLibraryRequest( + Guid Id +); diff --git a/src/Lumina.DataAccess/Core/Repositories/Authorization/PermissionRepository.cs b/src/Lumina.DataAccess/Core/Repositories/Authorization/PermissionRepository.cs index 6cf0db57..6a8b0058 100644 --- a/src/Lumina.DataAccess/Core/Repositories/Authorization/PermissionRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/Authorization/PermissionRepository.cs @@ -35,7 +35,7 @@ internal sealed class PermissionRepository : IPermissionRepository /// /// The authorization permission to add. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public async Task> InsertAsync(PermissionEntity permission, CancellationToken cancellationToken) { bool permissionExists = await _luminaDbContext.Permissions.AnyAsync(repositoryPermission => repositoryPermission.Id == permission.Id, cancellationToken).ConfigureAwait(false); diff --git a/src/Lumina.DataAccess/Core/Repositories/Authorization/RolePermissionRepository.cs b/src/Lumina.DataAccess/Core/Repositories/Authorization/RolePermissionRepository.cs index 5803ba1c..569c6ada 100644 --- a/src/Lumina.DataAccess/Core/Repositories/Authorization/RolePermissionRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/Authorization/RolePermissionRepository.cs @@ -30,7 +30,7 @@ internal sealed class RolePermissionRepository : IRolePermissionRepository /// /// The authorization role permission to add. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public async Task> InsertAsync(RolePermissionEntity rolePermission, CancellationToken cancellationToken) { _luminaDbContext.RolePermissions.Add(rolePermission); diff --git a/src/Lumina.DataAccess/Core/Repositories/Authorization/RoleRepository.cs b/src/Lumina.DataAccess/Core/Repositories/Authorization/RoleRepository.cs index 5c8961b2..98259a9e 100644 --- a/src/Lumina.DataAccess/Core/Repositories/Authorization/RoleRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/Authorization/RoleRepository.cs @@ -34,7 +34,7 @@ internal sealed class RoleRepository : IRoleRepository /// /// The authorization role to add. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public async Task> InsertAsync(RoleEntity role, CancellationToken cancellationToken) { bool roleExists = await _luminaDbContext.Roles.AnyAsync(repositoryRole => repositoryRole.Id == role.Id || repositoryRole.RoleName == role.RoleName, cancellationToken).ConfigureAwait(false); @@ -90,7 +90,7 @@ internal sealed class RoleRepository : IRoleRepository /// /// The role to update. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public async Task> UpdateAsync(RoleEntity data, CancellationToken cancellationToken) { // check if a role with the requested Id exists, and retrieve it @@ -114,7 +114,7 @@ internal sealed class RoleRepository : IRoleRepository /// /// The id of the role to be deleted. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public async Task> DeleteByIdAsync(Guid id, CancellationToken cancellationToken) { // check if a role with the requested Id exists, and retrieve it diff --git a/src/Lumina.DataAccess/Core/Repositories/Authorization/UserRoleRepository.cs b/src/Lumina.DataAccess/Core/Repositories/Authorization/UserRoleRepository.cs index 27a8dd05..33fa5e64 100644 --- a/src/Lumina.DataAccess/Core/Repositories/Authorization/UserRoleRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/Authorization/UserRoleRepository.cs @@ -30,7 +30,7 @@ internal sealed class UserRoleRepository : IUserRoleRepository /// /// The authorization user role to add. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public async Task> InsertAsync(UserRoleEntity userRole, CancellationToken cancellationToken) { _luminaDbContext.UserRoles.Add(userRole); diff --git a/src/Lumina.DataAccess/Core/Repositories/Books/BookRepository.cs b/src/Lumina.DataAccess/Core/Repositories/Books/BookRepository.cs index e1fa1799..be6e0c3e 100644 --- a/src/Lumina.DataAccess/Core/Repositories/Books/BookRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/Books/BookRepository.cs @@ -35,7 +35,7 @@ internal sealed class BookRepository : IBookRepository /// /// The book to add. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public async Task> InsertAsync(BookEntity book, CancellationToken cancellationToken) { bool bookExists = await _luminaDbContext.Books.AnyAsync(repositoryBook => repositoryBook.Id == book.Id, cancellationToken: cancellationToken).ConfigureAwait(false); diff --git a/src/Lumina.DataAccess/Core/Repositories/Libraries/LibraryRepository.cs b/src/Lumina.DataAccess/Core/Repositories/Libraries/LibraryRepository.cs index 3ef5d3b6..278291e2 100644 --- a/src/Lumina.DataAccess/Core/Repositories/Libraries/LibraryRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/Libraries/LibraryRepository.cs @@ -6,6 +6,7 @@ using Lumina.DataAccess.Core.UoW; using Lumina.Domain.Common.Errors; using Microsoft.EntityFrameworkCore; using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; #endregion @@ -33,7 +34,7 @@ internal sealed class LibraryRepository : ILibraryRepository /// /// The library to add. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public async Task> InsertAsync(LibraryEntity library, CancellationToken cancellationToken) { bool libraryExists = await _luminaDbContext.Libraries.AnyAsync(repositoryLibrary => repositoryLibrary.Id == library.Id, cancellationToken: cancellationToken).ConfigureAwait(false); @@ -57,12 +58,24 @@ internal sealed class LibraryRepository : ILibraryRepository .FirstOrDefaultAsync(library => library.Id == id, cancellationToken).ConfigureAwait(false); } + /// + /// Gets all media libraries. + /// + /// Cancellation token that can be used to stop the execution. + /// An containing either a collection of , or an error. + public async Task>> GetAllAsync(CancellationToken cancellationToken) + { + return await _luminaDbContext.Libraries + .Include(library => library.ContentLocations) + .ToListAsync(cancellationToken).ConfigureAwait(false); + } + /// /// Updates a media library. /// /// The media library to update. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public async Task> UpdateAsync(LibraryEntity data, CancellationToken cancellationToken) { LibraryEntity? foundLibrary = await _luminaDbContext.Libraries @@ -78,4 +91,24 @@ internal sealed class LibraryRepository : ILibraryRepository foundLibrary.ContentLocations.Add(contentLocation); return Result.Updated; } + + /// + /// Deletes a library by its ID. + /// + /// The ID of the library to delete. + /// Cancellation token that can be used to stop the execution. + /// An representing either a successful operation, or an error. + public async Task> DeleteByIdAsync(Guid id, CancellationToken cancellationToken) + { + LibraryEntity? library = await _luminaDbContext.Libraries + .Include(library => library.ContentLocations) + .FirstOrDefaultAsync(library => library.Id == id, cancellationToken) + .ConfigureAwait(false); + + if (library is null) + return Errors.Library.LibraryNotFound; + + _luminaDbContext.Libraries.Remove(library); + return Result.Deleted; + } } diff --git a/src/Lumina.DataAccess/Core/Repositories/Users/UserRepository.cs b/src/Lumina.DataAccess/Core/Repositories/Users/UserRepository.cs index fb061eed..1b9d9ff6 100644 --- a/src/Lumina.DataAccess/Core/Repositories/Users/UserRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/Users/UserRepository.cs @@ -35,7 +35,7 @@ internal sealed class UserRepository : IUserRepository /// /// The user to add. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public async Task> InsertAsync(UserEntity user, CancellationToken cancellationToken) { bool userExists = await _luminaDbContext.Users.AnyAsync(repositoryUser => repositoryUser.Id == user.Id, cancellationToken: cancellationToken).ConfigureAwait(false); @@ -80,7 +80,7 @@ internal sealed class UserRepository : IUserRepository /// /// Ther user to update. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public async Task> UpdateAsync(UserEntity data, CancellationToken cancellationToken) { UserEntity? foundUser = await _luminaDbContext.Users diff --git a/src/Lumina.DataAccess/Core/Seed/DataSeedService.cs b/src/Lumina.DataAccess/Core/Seed/DataSeedService.cs index 0489862b..2b0c1cff 100644 --- a/src/Lumina.DataAccess/Core/Seed/DataSeedService.cs +++ b/src/Lumina.DataAccess/Core/Seed/DataSeedService.cs @@ -41,7 +41,7 @@ public class DataSeedService : IDataSeedService /// /// The Id of the admin admin user who will own these permissions. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public async Task> SetDefaultAuthorizationPermissionsAsync(Guid adminId, CancellationToken cancellationToken) { IPermissionRepository permissionRepository = _unitOfWork.GetRepository(); @@ -51,7 +51,7 @@ public class DataSeedService : IDataSeedService new() { PermissionName = AuthorizationPermission.CanViewUsers, CreatedBy = adminId, CreatedOnUtc = _dateTimeProvider.UtcNow }, new() { PermissionName = AuthorizationPermission.CanDeleteUsers, CreatedBy = adminId, CreatedOnUtc = _dateTimeProvider.UtcNow }, new() { PermissionName = AuthorizationPermission.CanRegisterUsers, CreatedBy = adminId, CreatedOnUtc = _dateTimeProvider.UtcNow }, - new() { PermissionName = AuthorizationPermission.canCreateLibraries, CreatedBy = adminId, CreatedOnUtc = _dateTimeProvider.UtcNow } + new() { PermissionName = AuthorizationPermission.CanCreateLibraries, CreatedBy = adminId, CreatedOnUtc = _dateTimeProvider.UtcNow } ]; foreach (PermissionEntity permission in defaultPermissions) { @@ -68,7 +68,7 @@ public class DataSeedService : IDataSeedService /// /// The Id of the admin user for whom roles will be set. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public async Task> SetDefaultAuthorizationRolesAsync(Guid userId, CancellationToken cancellationToken) { IRoleRepository roleRepository = _unitOfWork.GetRepository(); @@ -93,7 +93,7 @@ public class DataSeedService : IDataSeedService /// /// The Id of the admin user to receive admin role permissions. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public async Task> SetAdminRolePermissionsAsync(Guid userId, CancellationToken cancellationToken) { IRolePermissionRepository rolePermissionRepository = _unitOfWork.GetRepository(); @@ -138,7 +138,7 @@ public class DataSeedService : IDataSeedService /// /// The Id of the admin user to receive the admin role. /// Cancellation token that can be used to stop the execution. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public async Task> SetAdminRoleToAdministratorAccount(Guid userId, CancellationToken cancellationToken) { IUserRoleRepository userRoleRepository = _unitOfWork.GetRepository(); diff --git a/src/Lumina.Domain/Common/Enums/Authorization/AuthorizationPermission.cs b/src/Lumina.Domain/Common/Enums/Authorization/AuthorizationPermission.cs index 250906ad..8aac2a56 100644 --- a/src/Lumina.Domain/Common/Enums/Authorization/AuthorizationPermission.cs +++ b/src/Lumina.Domain/Common/Enums/Authorization/AuthorizationPermission.cs @@ -9,5 +9,5 @@ public enum AuthorizationPermission CanViewUsers, CanDeleteUsers, CanRegisterUsers, - canCreateLibraries + CanCreateLibraries } diff --git a/src/Lumina.Domain/Common/ValueObjects/Metadata/Genre.cs b/src/Lumina.Domain/Common/ValueObjects/Metadata/Genre.cs index e076d9bf..c4349eab 100644 --- a/src/Lumina.Domain/Common/ValueObjects/Metadata/Genre.cs +++ b/src/Lumina.Domain/Common/ValueObjects/Metadata/Genre.cs @@ -32,7 +32,7 @@ public class Genre : ValueObject /// /// The value of the genre. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create(string? name) { diff --git a/src/Lumina.Domain/Common/ValueObjects/Metadata/LanguageInfo.cs b/src/Lumina.Domain/Common/ValueObjects/Metadata/LanguageInfo.cs index 2e7ea688..58583743 100644 --- a/src/Lumina.Domain/Common/ValueObjects/Metadata/LanguageInfo.cs +++ b/src/Lumina.Domain/Common/ValueObjects/Metadata/LanguageInfo.cs @@ -49,7 +49,7 @@ public class LanguageInfo : ValueObject /// The full name of the language in English. /// The optional native name of the language. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create(string? languageCode, string? languageName, Optional nativeName) { diff --git a/src/Lumina.Domain/Common/ValueObjects/Metadata/ReleaseInfo.cs b/src/Lumina.Domain/Common/ValueObjects/Metadata/ReleaseInfo.cs index 5056487d..2e016eec 100644 --- a/src/Lumina.Domain/Common/ValueObjects/Metadata/ReleaseInfo.cs +++ b/src/Lumina.Domain/Common/ValueObjects/Metadata/ReleaseInfo.cs @@ -81,7 +81,7 @@ public class ReleaseInfo : ValueObject /// The optional country or region of release. /// The optional release version or edition. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create( Optional originalReleaseDate, diff --git a/src/Lumina.Domain/Common/ValueObjects/Metadata/Tag.cs b/src/Lumina.Domain/Common/ValueObjects/Metadata/Tag.cs index ffb3f0cb..e76e6429 100644 --- a/src/Lumina.Domain/Common/ValueObjects/Metadata/Tag.cs +++ b/src/Lumina.Domain/Common/ValueObjects/Metadata/Tag.cs @@ -32,7 +32,7 @@ public class Tag : ValueObject /// /// The value of the tag. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create(string? name) { diff --git a/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/AudioLibraryAggregate/ValueObjects/AudioMetadata.cs b/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/AudioLibraryAggregate/ValueObjects/AudioMetadata.cs index 79848bc6..af41cb0c 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/AudioLibraryAggregate/ValueObjects/AudioMetadata.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/AudioLibraryAggregate/ValueObjects/AudioMetadata.cs @@ -102,7 +102,7 @@ public class AudioMetadata : BaseMetadata /// The genres of the audio. /// The tags associated with the audio. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create( string title, diff --git a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/Directory.cs b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/Directory.cs index 49093099..56cce569 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/Directory.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/Directory.cs @@ -55,7 +55,7 @@ public sealed class Directory : FileSystemItem /// The date and time the directory was last modified. Can be optional if unknown. /// The status of the file system item. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create( string path, @@ -87,7 +87,7 @@ public sealed class Directory : FileSystemItem /// The date and time the directory was last modified. Can be optional if unknown. /// The status of the file system item. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create( FileSystemPathId id, @@ -112,7 +112,7 @@ public sealed class Directory : FileSystemItem /// Updates the last modified date of the file system item. /// /// The new date and time of last modification. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public ErrorOr UpdateLastModified(DateTime date) { DateModified = date; @@ -123,7 +123,7 @@ public sealed class Directory : FileSystemItem /// Adds a file system item to the directory. /// /// The file system item to add. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public ErrorOr AddItem(FileSystemItem item) { _items.Add(item); @@ -134,7 +134,7 @@ public sealed class Directory : FileSystemItem /// Removes a file system item from the directory. /// /// The file system item to remove. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public ErrorOr RemoveItem(FileSystemItem item) { _items.Remove(item); diff --git a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/File.cs b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/File.cs index 832087d0..4c7addb0 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/File.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/File.cs @@ -56,7 +56,7 @@ public sealed class File : FileSystemItem /// The size of the file in bytes. /// The status of the file system item. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create( string path, @@ -92,7 +92,7 @@ public sealed class File : FileSystemItem /// The size of the file in bytes. /// The status of the file system item. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create( FileSystemPathId id, @@ -119,7 +119,7 @@ public sealed class File : FileSystemItem /// Updates the last modified date of the file system item. /// /// The new date and time of last modification. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public ErrorOr UpdateLastModified(DateTime date) { DateModified = date; @@ -130,7 +130,7 @@ public sealed class File : FileSystemItem /// Updates the size of the file. /// /// The new size, in bytes. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public ErrorOr UpdateSize(long newSize) { Size = newSize; @@ -141,7 +141,7 @@ public sealed class File : FileSystemItem /// Renames the file system item to the specified new name. /// /// The new name for the file system item. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public ErrorOr Rename(string newName) { if (string.IsNullOrWhiteSpace(newName)) diff --git a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/UnixRootItem.cs b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/UnixRootItem.cs index c74bcfcd..e15ad46c 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/UnixRootItem.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/UnixRootItem.cs @@ -37,7 +37,7 @@ public sealed class UnixRootItem : FileSystemItem /// /// The status of the file system root item. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create(FileSystemItemStatus status = FileSystemItemStatus.Accessible) { diff --git a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/WindowsRootItem.cs b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/WindowsRootItem.cs index 66eb6214..db0c7944 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/WindowsRootItem.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Entities/WindowsRootItem.cs @@ -38,7 +38,7 @@ public sealed class WindowsRootItem : FileSystemItem /// The name of the file system root item. /// The status of the file system root item. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create( string path, @@ -65,7 +65,7 @@ public sealed class WindowsRootItem : FileSystemItem /// The name of the file system root item. /// The status of the file system root item. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create( FileSystemPathId id, diff --git a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/FileSystemItem.cs b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/FileSystemItem.cs index 7687ce7b..12a6eda7 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/FileSystemItem.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/FileSystemItem.cs @@ -52,7 +52,7 @@ public abstract class FileSystemItem : AggregateRoot /// Sets the status of the filesystem item. /// /// The status to be set. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public ErrorOr SetStatus(FileSystemItemStatus status) { Status = status; @@ -63,7 +63,7 @@ public abstract class FileSystemItem : AggregateRoot /// Sets the parent of the filesystem item. /// /// The file system item to be set as parent. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public ErrorOr SetParent(FileSystemItem parent) { if (parent is not null) diff --git a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/FileSystemStructureSeedService.cs b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/FileSystemStructureSeedService.cs index 86f85951..c34a4ffd 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/FileSystemStructureSeedService.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/FileSystemStructureSeedService.cs @@ -30,7 +30,7 @@ internal class FileSystemStructureSeedService : IFileSystemStructureSeedService /// Sets up the default file system directories needed by the application. /// /// The base path where the directories will be created relative to. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. public ErrorOr SetDefaultDirectories(string rootPath) { // make sure the root path exists diff --git a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/IFileSystemStructureSeedService.cs b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/IFileSystemStructureSeedService.cs index 402ea42d..07653e44 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/IFileSystemStructureSeedService.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/IFileSystemStructureSeedService.cs @@ -13,6 +13,6 @@ public interface IFileSystemStructureSeedService /// Sets up the default file system directories needed by the application. /// /// The base path where the directories will be created relative to. - /// An representing either a successfull operation, or an error. + /// An representing either a successful operation, or an error. ErrorOr SetDefaultDirectories(string rootPath); } diff --git a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/ValueObjects/FileSystemPathId.cs b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/ValueObjects/FileSystemPathId.cs index 97d5e626..6d566fcb 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/ValueObjects/FileSystemPathId.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/ValueObjects/FileSystemPathId.cs @@ -39,7 +39,7 @@ public sealed class FileSystemPathId : ValueObject /// /// The path of the file system item. /// - /// An containing either a successfully created or an error message. + /// An containing either a successfuly created or an error message. /// public static ErrorOr Create(string path) { diff --git a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/ValueObjects/PathSegment.cs b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/ValueObjects/PathSegment.cs index 3b3462ac..3039fbaf 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/ValueObjects/PathSegment.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/ValueObjects/PathSegment.cs @@ -49,7 +49,7 @@ public class PathSegment : ValueObject /// Value indicating if the current path segment is a file system directory or not. /// Value indicating if the current path segment is a file system drive or not. /// - /// An containing either a successfully created or an error message. + /// An containing either a successfuly created or an error message. /// public static ErrorOr Create(string name, bool isDirectory, bool isDrive) { diff --git a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/ValueObjects/StreamInfo.cs b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/ValueObjects/StreamInfo.cs index ae46567c..2339616f 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/ValueObjects/StreamInfo.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/ValueObjects/StreamInfo.cs @@ -98,7 +98,7 @@ public class StreamInfo : ValueObject /// The sample rate of the stream (for audio). /// The number of channels (for audio). /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create( string streamId, diff --git a/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/Events/LibraryDeletedDomainEvent.cs b/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/Events/LibraryDeletedDomainEvent.cs new file mode 100644 index 00000000..32b1c7b9 --- /dev/null +++ b/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/Events/LibraryDeletedDomainEvent.cs @@ -0,0 +1,20 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Domain.Common.Events; +using System; +using System.Diagnostics; +#endregion + +namespace Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.Events; + +/// +/// Domain event raised when a libary is deleted. +/// +/// The Id of the domain event. +/// The library that was deleted. +/// The date and time when the domain event occurred. +[DebuggerDisplay("Id: {Library.Id} Title: {Library.Title}")] +public record LibraryDeletedDomainEvent( + Guid Id, + Library Library, + DateTime OccurredOnUtc +) : IDomainEvent; diff --git a/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/Library.cs b/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/Library.cs index 9fdadc05..401381bc 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/Library.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/Library.cs @@ -9,6 +9,7 @@ using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserAggreg using System; using System.Collections.Generic; using System.Diagnostics; +using System.Linq; #endregion namespace Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate; @@ -86,7 +87,7 @@ public class Library : AggregateRoot /// The list of file system paths that make up the media library. /// The path of the image file chosen by the user to be used as the cover for the library. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create( Guid userId, @@ -124,7 +125,7 @@ public class Library : AggregateRoot /// The list of file system paths that make up the media library. /// The path of the image file chosen by the user to be used as the cover for the library. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create( LibraryId id, @@ -161,4 +162,20 @@ public class Library : AggregateRoot { CoverImage = path; } + + /// + /// Marks the current library as deleted. + /// + public ErrorOr Delete() + { + // clear all existing events since they become irrelevant when the entity is deleted, and they dont need to be processed + _domainEvents.Clear(); + + // only add the delete event if it hasn't been added already + if (!_domainEvents.Any(e => e is LibraryDeletedDomainEvent)) + _domainEvents.Add(new LibraryDeletedDomainEvent(Guid.NewGuid(), this, DateTime.UtcNow)); + + // TODO: perhaps trigger events for removing contents related to the removed library (media metadata, etc)? + return Result.Deleted; + } } diff --git a/src/Lumina.Domain/Core/BoundedContexts/UserManagementBoundedContext/UserAggregate/User.cs b/src/Lumina.Domain/Core/BoundedContexts/UserManagementBoundedContext/UserAggregate/User.cs index 953b6b96..837df0b3 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/UserManagementBoundedContext/UserAggregate/User.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/UserManagementBoundedContext/UserAggregate/User.cs @@ -35,7 +35,7 @@ public sealed class User : AggregateRoot /// /// The username of the user. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create( string username) @@ -51,7 +51,7 @@ public sealed class User : AggregateRoot /// The object representing the id of the user. /// The username of the user. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create( UserId id, diff --git a/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/MovieLibraryAggregate/ValueObjects/VideoMetadata.cs b/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/MovieLibraryAggregate/ValueObjects/VideoMetadata.cs index 23eff432..d5736ec7 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/MovieLibraryAggregate/ValueObjects/VideoMetadata.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/VideoLibraryBoundedContext/MovieLibraryAggregate/ValueObjects/VideoMetadata.cs @@ -96,7 +96,7 @@ public class VideoMetadata : BaseMetadata /// The genres of the video. /// The tags associated with the video. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create( string title, diff --git a/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/Book.cs b/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/Book.cs index f4297158..e706d27a 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/Book.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/Book.cs @@ -206,7 +206,7 @@ public sealed class Book : AggregateRoot /// The list of media contributors of the book. /// The list of ratings for the book. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create( WrittenContentMetadata metadata, @@ -276,7 +276,7 @@ public sealed class Book : AggregateRoot /// The list of media contributors of the book. /// The list of ratings for the book. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create( BookId id, diff --git a/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/Entities/BookSeries.cs b/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/Entities/BookSeries.cs index 649fdf88..2cea20bf 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/Entities/BookSeries.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/Entities/BookSeries.cs @@ -56,7 +56,7 @@ public sealed class BookSeries : Entity /// The current status of the book series. /// The books of the book series. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create( BookSeriesId id, @@ -80,7 +80,7 @@ public sealed class BookSeries : Entity /// The current status of the book series. /// The books of the book series. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create( WrittenContentMetadata metadata, diff --git a/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/ValueObjects/BookRating.cs b/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/ValueObjects/BookRating.cs index 9bd0af3d..99a51a8c 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/ValueObjects/BookRating.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/ValueObjects/BookRating.cs @@ -42,7 +42,7 @@ public class BookRating : Rating /// The optional source of the rating. /// The optional number of votes or reviews. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create(decimal value, decimal maxValue, Optional source, Optional voteCount) { diff --git a/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/ValueObjects/WrittenContentMetadata.cs b/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/ValueObjects/WrittenContentMetadata.cs index 04c7c429..68cf3b7d 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/ValueObjects/WrittenContentMetadata.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/ValueObjects/WrittenContentMetadata.cs @@ -69,7 +69,7 @@ public class WrittenContentMetadata : BaseMetadata /// The publisher of the written content, if applicable. /// The number of pages in the written content, if applicable. /// - /// An containing either a successfully created , or an error message. + /// An containing either a successfuly created , or an error message. /// public static ErrorOr Create( string title, diff --git a/src/Lumina.Presentation.Api/Common/Middlewares/EventualConsistencyMiddleware.cs b/src/Lumina.Presentation.Api/Common/Middlewares/EventualConsistencyMiddleware.cs index c1568008..2409e12e 100644 --- a/src/Lumina.Presentation.Api/Common/Middlewares/EventualConsistencyMiddleware.cs +++ b/src/Lumina.Presentation.Api/Common/Middlewares/EventualConsistencyMiddleware.cs @@ -13,7 +13,7 @@ using System.Threading.Tasks; namespace Lumina.Presentation.Api.Common.Middlewares; /// -/// Middleware that ensures eventual consistency by handling domain events and publishing them after the request has completed successfully. +/// Middleware that ensures eventual consistency by handling domain events and publishing them after the request has completed successfuly. /// public class EventualConsistencyMiddleware { @@ -24,6 +24,7 @@ public class EventualConsistencyMiddleware /// Initializes a new instance of the class. /// /// The next middleware in the HTTP request pipeline. + /// Injected service for logging. public EventualConsistencyMiddleware(RequestDelegate next, ILogger logger) { _next = next; diff --git a/src/Lumina.Presentation.Api/Common/Routes/Library/Management/ApiRoutes.Libraries.cs b/src/Lumina.Presentation.Api/Common/Routes/Library/Management/ApiRoutes.Libraries.cs index bb67db20..d7726077 100644 --- a/src/Lumina.Presentation.Api/Common/Routes/Library/Management/ApiRoutes.Libraries.cs +++ b/src/Lumina.Presentation.Api/Common/Routes/Library/Management/ApiRoutes.Libraries.cs @@ -14,5 +14,6 @@ public static partial class ApiRoutes public const string GET_LIBRARIES = "/libraries"; public const string ADD_LIBRARY = "/libraries"; public const string UPDATE_LIBRARY = "/libraries/{id}"; + public const string DELETE_LIBRARY = "/libraries/{id}"; } } diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpointSummary.cs index 5a983271..14400851 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpointSummary.cs @@ -40,7 +40,7 @@ public class AddRoleEndpointSummary : Summary ResponseParam(r => r.Permissions, "The list of permissions of the role entity."); - Response(200, "The authorization role was successfully created.", example: + Response(200, "The authorization role was successfuly created.", example: new RolePermissionsResponse( Role: new RoleDto(Id: Guid.NewGuid(), "Editor"), Permissions: [new PermissionDto(Guid.NewGuid(), AuthorizationPermission.CanDeleteUsers), new PermissionDto(Guid.NewGuid(), AuthorizationPermission.CanViewUsers)] diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Admin/Authorization/Roles/DeleteRole/DeleteRoleEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Admin/Authorization/Roles/DeleteRole/DeleteRoleEndpointSummary.cs index de3ebad8..55780e92 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Admin/Authorization/Roles/DeleteRole/DeleteRoleEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Admin/Authorization/Roles/DeleteRole/DeleteRoleEndpointSummary.cs @@ -30,7 +30,7 @@ public class DeleteRoleEndpointSummary : Summary r.RoleId, "The Id of the role. Required."); - Response(204, "The authorization role was successfully deleted."); + Response(204, "The authorization role was successfuly deleted."); Response(401, "Authentication required.", "application/problem+json", example: new[] diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Admin/Authorization/Roles/UpdateRole/UpdateRoleEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Admin/Authorization/Roles/UpdateRole/UpdateRoleEndpointSummary.cs index f9ef03f4..f2594f48 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Admin/Authorization/Roles/UpdateRole/UpdateRoleEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Admin/Authorization/Roles/UpdateRole/UpdateRoleEndpointSummary.cs @@ -42,7 +42,7 @@ public class UpdateRoleEndpointSummary : Summary(r => r.Permissions, "The list of permissions of the role entity."); - Response(200, "The authorization role was successfully updated.", example: + Response(200, "The authorization role was successfuly updated.", example: new RolePermissionsResponse( Role: new RoleDto(Id: Guid.NewGuid(), "Editor"), Permissions: [new PermissionDto(Guid.NewGuid(), AuthorizationPermission.CanDeleteUsers), new PermissionDto(Guid.NewGuid(), AuthorizationPermission.CanViewUsers)] diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/FileSystemManagement/Path/SplitPath/SplitPathEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/FileSystemManagement/Path/SplitPath/SplitPathEndpointSummary.cs index 21e6a5fb..b7064267 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/FileSystemManagement/Path/SplitPath/SplitPathEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/FileSystemManagement/Path/SplitPath/SplitPathEndpointSummary.cs @@ -28,7 +28,7 @@ public class SplitPathEndpointSummary : Summary r.Path, "The file system path for which to get the path segments. Required."); - Response(200, "Successfully split the path into segments.", + Response(200, "successfuly split the path into segments.", example: new PathSegmentResponse[2] { new(Path: "media"), new(Path: "movies") diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/AddLibrary/AddLibraryEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/AddLibrary/AddLibraryEndpointSummary.cs index b5e40da2..2f8ecf72 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/AddLibrary/AddLibraryEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/AddLibrary/AddLibraryEndpointSummary.cs @@ -49,7 +49,7 @@ public class AddLibraryEndpointSummary : Summary(r => r.UpdatedOnUtc, "The date and time when the entity was last updated."); - Response(201, "The media library was successfully created.", example: + Response(201, "The media library was successfuly created.", example: new LibraryResponse( Id: Guid.NewGuid(), UserId: Guid.NewGuid(), diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/DeleteLibrary/DeleteLibraryEndpoint.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/DeleteLibrary/DeleteLibraryEndpoint.cs new file mode 100644 index 00000000..acdaaccc --- /dev/null +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/DeleteLibrary/DeleteLibraryEndpoint.cs @@ -0,0 +1,53 @@ +#region ========================================================================= USING ===================================================================================== +using ErrorOr; +using FastEndpoints; +using Lumina.Contracts.Requests.MediaLibrary.Management; +using Lumina.Presentation.Api.Common.Routes.Library.Management; +using Lumina.Presentation.Api.Core.Endpoints.Common; +using Mediator; +using Microsoft.AspNetCore.Http; +using Lumina.Application.Common.Mapping.MediaLibrary.Management; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.DeleteLibrary; + +/// +/// API endpoint for the //libraries/{id} route. +/// +public class DeleteLibraryEndpoint : BaseEndpoint +{ + private readonly ISender _sender; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for mediating commands and queries. + public DeleteLibraryEndpoint(ISender sender) + { + _sender = sender; + } + + /// + /// Configures the API endpoint. + /// + public override void Configure() + { + Verbs(Http.DELETE); + Routes(ApiRoutes.Libraries.DELETE_LIBRARY); + Version(1); + DontCatchExceptions(); + } + + /// + /// Deletes a library by Id. + /// + /// The request containing the id of the library to be deleted. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(DeleteLibraryRequest request, CancellationToken cancellationToken) + { + ErrorOr result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false); + return result.Match(success => TypedResults.Ok(success), Problem); + } +} diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/GetLibraries/GetLibrariesEndpoint.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/GetLibraries/GetLibrariesEndpoint.cs new file mode 100644 index 00000000..83012128 --- /dev/null +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/GetLibraries/GetLibrariesEndpoint.cs @@ -0,0 +1,53 @@ +#region ========================================================================= USING ===================================================================================== +using ErrorOr; +using FastEndpoints; +using Lumina.Application.Core.MediaLibrary.Management.Queries.GetLibraries; +using Lumina.Contracts.Responses.MediaLibrary.Management; +using Lumina.Presentation.Api.Common.Routes.Library.Management; +using Lumina.Presentation.Api.Core.Endpoints.Common; +using Mediator; +using Microsoft.AspNetCore.Http; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.GetLibraries; + +/// +/// API endpoint for the /libraries route. +/// +public class GetLibrariesEndpoint : BaseEndpoint +{ + private readonly ISender _sender; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for mediating commands and queries. + public GetLibrariesEndpoint(ISender sender) + { + _sender = sender; + } + + /// + /// Configures the API endpoint. + /// + public override void Configure() + { + Verbs(Http.GET); + Routes(ApiRoutes.Libraries.GET_LIBRARIES); + Version(1); + DontCatchExceptions(); + } + + /// + /// Gets the list of libraries. + /// + /// The request containing the id of the library to be retrieved. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(EmptyRequest _, CancellationToken cancellationToken) + { + ErrorOr result = await _sender.Send(new GetLibrariesQuery(), cancellationToken).ConfigureAwait(false); + return result.Match(success => TypedResults.Ok(success), Problem); + } +} diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/GetLibraries/GetLibrariesEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/GetLibraries/GetLibrariesEndpointSummary.cs new file mode 100644 index 00000000..8ca542f9 --- /dev/null +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/GetLibraries/GetLibrariesEndpointSummary.cs @@ -0,0 +1,80 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Contracts.Responses.MediaLibrary.Management; +using Lumina.Domain.Common.Enums.MediaLibrary; +using System; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.GetLibraries; + +/// +/// Class used for providing a textual description for the API endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class GetLibrariesEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public GetLibrariesEndpointSummary() + { + Summary = "Retrieves the list of media libraries."; + Description = "Retrieves the entire list of media libraries, if the user making the request is an Admin, or just the library owned by them, for regular users."; + + Response(200, "The media libraries are returned.", + example: new LibraryResponse[] { + new ( + Id: Guid.NewGuid(), + UserId: Guid.NewGuid(), + Title: "TV Shows", + LibraryType: LibraryType.TvShow, + ContentLocations: ["/media/tv shows/drama/", "/media/tv shows/SCI-FI/"], + CoverImage: "/media/myTvShowPoster.jpg", + CreatedOnUtc: DateTime.UtcNow, + UpdatedOnUtc: default + ), + new ( + Id: Guid.NewGuid(), + UserId: Guid.NewGuid(), + Title: "Movies", + LibraryType: LibraryType.TvShow, + ContentLocations: ["/media/movies/"], + CoverImage: "/media/myMoviePoster.jpg", + CreatedOnUtc: DateTime.UtcNow, + UpdatedOnUtc: default + ) + }); + + + Response(401, "Authentication required.", "application/problem+json", + example: new[] + { + new + { + type = "https://tools.ietf.org/html/rfc7235#section-3.1", + status = 401, + title = "Unauthorized", + detail = "You are not authorized", + instance = "/api/v1/libraries" + }, + new + { + type = "https://tools.ietf.org/html/rfc7235#section-3.1", + status = 401, + title = "Unauthorized", + detail = "Invalid token: The token expired at '01/01/2024 01:00:00'", + instance = "/api/v1/libraries" + }, + new + { + type = "https://tools.ietf.org/html/rfc7235#section-3.1", + status = 401, + title = "Unauthorized", + detail = "The token is invalid", + instance = "/api/v1/libraries" + } + } + ); + } +} diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/GetLibrary/GetLibraryEndpoint.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/GetLibrary/GetLibraryEndpoint.cs index ddb0c0b2..9a336d3e 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/GetLibrary/GetLibraryEndpoint.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/GetLibrary/GetLibraryEndpoint.cs @@ -8,8 +8,6 @@ using Lumina.Presentation.Api.Common.Routes.Library.Management; using Lumina.Presentation.Api.Core.Endpoints.Common; using Mediator; using Microsoft.AspNetCore.Http; -using System; -using System.Security.Claims; using System.Threading; using System.Threading.Tasks; #endregion @@ -50,9 +48,7 @@ public class GetLibraryEndpoint : BaseEndpoint /// Cancellation token that can be used to stop the execution. public override async Task ExecuteAsync(GetLibraryRequest request, CancellationToken cancellationToken) { - // retrieve the currently authenticated user, and send it with the request - string? user = User.FindFirstValue(ClaimTypes.NameIdentifier); - ErrorOr result = await _sender.Send(request.ToQuery(Guid.Parse(user!)), cancellationToken).ConfigureAwait(false); + ErrorOr result = await _sender.Send(request.ToQuery(), cancellationToken).ConfigureAwait(false); return result.Match(success => TypedResults.Ok(success), Problem); } } diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/UpdateLibrary/UpdateLibraryEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/UpdateLibrary/UpdateLibraryEndpointSummary.cs index 4a2fa096..f436ba7c 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/UpdateLibrary/UpdateLibraryEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/Management/UpdateLibrary/UpdateLibraryEndpointSummary.cs @@ -53,7 +53,7 @@ public class UpdateLibraryEndpointSummary : Summary(r => r.UpdatedOnUtc, "The date and time when the entity was last updated."); - Response(200, "The media library was successfully updated.", example: + Response(200, "The media library was successfuly updated.", example: new LibraryResponse( Id: Guid.NewGuid(), UserId: Guid.NewGuid(), diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointSummary.cs index f10d7f0c..59c291d2 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointSummary.cs @@ -265,6 +265,5 @@ public class GetBooksEndpointSummary : Summary } } ); - } } diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Authorization/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Authorization/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsEndpointSummary.cs index f1446150..96fddeed 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Authorization/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Authorization/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsEndpointSummary.cs @@ -43,7 +43,7 @@ public class UpdateUserRoleAndPermissionsEndpointSummary : Summary(r => r.Permissions, "The list of permissions of the user."); - Response(200, "The authorization role and permissions of the user were successfully updated.", example: + Response(200, "The authorization role and permissions of the user were successfuly updated.", example: new AuthorizationResponse( UserId: Guid.NewGuid(), Role: "Editor", diff --git a/src/Lumina.Presentation.Web/Common/Enums/Authorization/AuthorizationPermission.cs b/src/Lumina.Presentation.Web/Common/Enums/Authorization/AuthorizationPermission.cs index 312f9a26..e56b9514 100644 --- a/src/Lumina.Presentation.Web/Common/Enums/Authorization/AuthorizationPermission.cs +++ b/src/Lumina.Presentation.Web/Common/Enums/Authorization/AuthorizationPermission.cs @@ -9,5 +9,5 @@ public enum AuthorizationPermission CanViewUsers, CanDeleteUsers, CanRegisterUsers, - canCreateLibraries + CanCreateLibraries } diff --git a/src/Lumina.Presentation.Web/Common/Middlewares/NotFoundRedirectMiddleware.cs b/src/Lumina.Presentation.Web/Common/Middlewares/NotFoundRedirectMiddleware.cs index c2568966..efd0e9f3 100644 --- a/src/Lumina.Presentation.Web/Common/Middlewares/NotFoundRedirectMiddleware.cs +++ b/src/Lumina.Presentation.Web/Common/Middlewares/NotFoundRedirectMiddleware.cs @@ -1,5 +1,7 @@ #region ========================================================================= USING ===================================================================================== using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Localization; +using Microsoft.Extensions.Logging; using System.Threading.Tasks; #endregion @@ -11,14 +13,17 @@ namespace Lumina.Presentation.Web.Common.Middlewares; public class NotFoundRedirectMiddleware { private readonly RequestDelegate _next; + private readonly ILogger _logger; /// /// Initializes a new instance of the class. /// /// The next middleware in the request pipeline. - public NotFoundRedirectMiddleware(RequestDelegate next) + /// Injected service for logging. + public NotFoundRedirectMiddleware(RequestDelegate next, ILogger logger) { _next = next; + _logger = logger; } /// @@ -26,18 +31,20 @@ public class NotFoundRedirectMiddleware /// /// The for the current request. public async Task InvokeAsync(HttpContext context) - { + { await _next(context); if (context.Response.StatusCode == 404 && !context.Response.HasStarted) { - string culture = context.Request.RouteValues["culture"]?.ToString()?.ToLower() ?? "en-us"; - string notFoundUrl = $"/{culture}/not-found"; - + string culture = context.Request.RouteValues["culture"]?.ToString()?.ToLower() ?? + context.Features.Get()?.RequestCulture.Culture.Name?.ToLower() ?? + "en-us"; + // re-execute the request so the user gets the error page string? originalPath = context.Request.Path.Value; context.Items["originalPath"] = originalPath; - context.Request.Path = notFoundUrl; + _logger.LogInformation("Redirecting user to NotFound url"); + context.Request.Path = $"/{culture}/not-found"; await _next(context); } } diff --git a/src/Lumina.Presentation.Web/Controllers/Library/Management/LibraryManagementController.cs b/src/Lumina.Presentation.Web/Controllers/Library/Management/LibraryManagementController.cs index bd36f674..027a54a6 100644 --- a/src/Lumina.Presentation.Web/Controllers/Library/Management/LibraryManagementController.cs +++ b/src/Lumina.Presentation.Web/Controllers/Library/Management/LibraryManagementController.cs @@ -12,8 +12,11 @@ using System.Threading.Tasks; namespace Lumina.Presentation.Web.Controllers.Library.Management; +/// +/// Controller for media libraries related operations. +/// [Authorize] -[Route("{culture}/library/manage")] +[Route("{culture}/libraries/manage")] public class LibraryManagementController : Controller { private readonly IApiHttpClient _apiHttpClient; @@ -30,6 +33,7 @@ public class LibraryManagementController : Controller /// /// Displays the view for displaying the list of media libraries. /// + /// Cancellation token that can be used to stop the execution. [HttpGet("")] public IActionResult Index() { @@ -42,8 +46,8 @@ public class LibraryManagementController : Controller [HttpGet("item")] public IActionResult AddLibrary() { - LibraryModel libraryModel = new(); - return View("/Views/Library/Management/Item.cshtml", libraryModel); + LibraryModel library = new(); + return View("/Views/Library/Management/Item.cshtml", library); } /// @@ -54,8 +58,19 @@ public class LibraryManagementController : Controller [HttpGet("item/{id}")] public async Task EditLibrary(Guid id, CancellationToken cancellationToken = default) { - LibraryModel libraryModel = await _apiHttpClient.GetAsync($"libraries/{id}", cancellationToken).ConfigureAwait(false); - return View("/Views/Library/Management/Item.cshtml", libraryModel); + LibraryModel response = await _apiHttpClient.GetAsync($"libraries/{id}", cancellationToken).ConfigureAwait(false); + return View("/Views/Library/Management/Item.cshtml", response); + } + + /// + /// Gets the list of media libraries. + /// + /// Cancellation token that can be used to stop the execution. + [HttpGet("api-get-libraries")] + public async Task GetLibraries(CancellationToken cancellationToken = default) + { + LibraryModel[] response = await _apiHttpClient.GetAsync($"libraries/", cancellationToken).ConfigureAwait(false); + return Json(new { success = true, data = response }); } /// @@ -65,7 +80,7 @@ public class LibraryManagementController : Controller /// Cancellation token that can be used to stop the execution. [ValidateAntiForgeryToken] [HttpPost("api-item")] - [RequirePermission(AuthorizationPermission.canCreateLibraries)] + [RequirePermission(AuthorizationPermission.CanCreateLibraries)] public async Task SaveLibrary([FromBody] LibraryModel data, CancellationToken cancellationToken) { // call different API endpoints based on whether this is a new library or an existing one @@ -74,4 +89,16 @@ public class LibraryManagementController : Controller : await _apiHttpClient.PostAsync("libraries", data, cancellationToken).ConfigureAwait(false); return Json(new { success = true, data = response }); } + + /// + /// Deletes a media library. + /// + /// The id of the media library to delete. + /// Cancellation token that can be used to stop the execution. + [HttpDelete("api-item/{id}")] + public async Task DeleteLibrary(Guid id, CancellationToken cancellationToken = default) + { + await _apiHttpClient.DeleteAsync($"libraries/{id}", cancellationToken).ConfigureAwait(false); + return Json(new { success = true }); + } } diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.de-DE.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.de-DE.resx index 765a5384..cc009918 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.de-DE.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.de-DE.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Kann Mediatheken erstellen + Kann Benutzer löschen diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.en-US.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.en-US.resx index 1ba01825..2371da2e 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.en-US.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.en-US.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Can create libraries + Can delete users diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.es-ES.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.es-ES.resx index 71d285c2..45ff854c 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.es-ES.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.es-ES.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Puede crear bibliotecas + Puede eliminar usuarios diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.fr-FR.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.fr-FR.resx index 30b59ac8..3971ce5c 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.fr-FR.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.fr-FR.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Peut créer des médiathèques + Peut supprimer des utilisateurs diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.it-IT.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.it-IT.resx index e5bfea1c..610e11b2 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.it-IT.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.it-IT.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Può creare librerie + Può eliminare utenti diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.ja-JP.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.ja-JP.resx index b1dba7cc..04c51b58 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.ja-JP.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.ja-JP.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ライブラリを作成可能 + ユーザーを削除できます diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.resx index 1ba01825..2371da2e 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Can create libraries + Can delete users diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.ro-RO.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.ro-RO.resx index b6a988d8..defadc98 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.ro-RO.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.ro-RO.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Poate crea biblioteci + Poate șterge utilizatori diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.ru-RU.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.ru-RU.resx index f04a30ac..729c7e0e 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.ru-RU.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.ru-RU.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Может создавать библиотеки + Может удалять пользователей diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.zh-CN.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.zh-CN.resx index eb9218a9..3bffe53e 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.zh-CN.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManagePermissions.zh-CN.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 可以创建媒体库 + 可以删除用户 diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.de-DE.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.de-DE.resx index 3eb44e11..1c6204f4 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.de-DE.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.de-DE.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Kann Mediatheken erstellen + Kann Benutzer löschen diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.en-US.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.en-US.resx index 6e704f38..a842f279 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.en-US.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.en-US.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Can create libraries + Can delete users diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.es-ES.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.es-ES.resx index fbaaee5f..92dbe451 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.es-ES.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.es-ES.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Puede crear bibliotecas + Puede eliminar usuarios diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.fr-FR.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.fr-FR.resx index 54eda429..1a8e040b 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.fr-FR.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.fr-FR.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Peut créer des médiathèques + Peut supprimer des utilisateurs diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.it-IT.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.it-IT.resx index 7aa36d29..805672aa 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.it-IT.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.it-IT.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Può creare librerie + Può eliminare utenti diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.ja-JP.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.ja-JP.resx index efbe9027..9b5e74d7 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.ja-JP.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.ja-JP.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ライブラリを作成可能 + ユーザーを削除できます diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.resx index 6e704f38..a842f279 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Can create libraries + Can delete users diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.ro-RO.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.ro-RO.resx index e0688295..01689d29 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.ro-RO.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.ro-RO.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Poate crea biblioteci + Poate șterge utilizatori diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.ru-RU.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.ru-RU.resx index 30d5a8be..46e83d40 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.ru-RU.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.ru-RU.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Может создавать библиотеки + Может удалять пользователей diff --git a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.zh-CN.resx b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.zh-CN.resx index ef61be7c..537300f7 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.zh-CN.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Admin/ManageRoles.zh-CN.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 可以创建媒体库 + 可以删除用户 diff --git a/src/Lumina.Presentation.Web/Resources/Views/Home/Index.de-DE.resx b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.de-DE.resx new file mode 100644 index 00000000..45dca514 --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.de-DE.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Keine Bibliotheken + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Home/Index.en-US.resx b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.en-US.resx new file mode 100644 index 00000000..d3883307 --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.en-US.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + No libraries + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Home/Index.es-ES.resx b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.es-ES.resx new file mode 100644 index 00000000..5eb2e603 --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.es-ES.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Sin bibliotecas + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Home/Index.fr-FR.resx b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.fr-FR.resx new file mode 100644 index 00000000..4fb27e5a --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.fr-FR.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Aucune bibliothèque + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Home/Index.it-IT.resx b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.it-IT.resx new file mode 100644 index 00000000..a018f86d --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.it-IT.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Nessuna libreria + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Home/Index.ja-JP.resx b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.ja-JP.resx new file mode 100644 index 00000000..b826da97 --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.ja-JP.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ライブラリがありません + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Home/Index.resx b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.resx new file mode 100644 index 00000000..5bc23ade --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + No libraries + + diff --git a/src/Lumina.Presentation.Web/Resources/Views/Home/Index.ro-RO.resx b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.ro-RO.resx new file mode 100644 index 00000000..c44563bc --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.ro-RO.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Nicio bibliotecă + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Home/Index.ru-RU.resx b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.ru-RU.resx new file mode 100644 index 00000000..1b297550 --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.ru-RU.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Нет библиотек + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Home/Index.zh-CN.resx b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.zh-CN.resx new file mode 100644 index 00000000..4fdb1b6a --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.zh-CN.resx @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.de-DE.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.de-DE.resx new file mode 100644 index 00000000..f64df03a --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.de-DE.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Sind Sie sicher, dass Sie die ausgewählte Bibliothek löschen möchten? + + + Bearbeiten + + + Bibliotheken + + + Die Bibliothek wurde gelöscht! + + + Keine Bibliotheken + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.en-US.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.en-US.resx new file mode 100644 index 00000000..e28890f7 --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.en-US.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Are you sure you want to delete the specified library? + + + Edit + + + Libraries + + + The library has been deleted! + + + No libraries + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.es-ES.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.es-ES.resx new file mode 100644 index 00000000..d73a41d8 --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.es-ES.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ¿Está seguro de que desea eliminar la biblioteca especificada? + + + Editar + + + Bibliotecas + + + ¡La biblioteca ha sido eliminada! + + + Sin bibliotecas + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.fr-FR.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.fr-FR.resx new file mode 100644 index 00000000..ec01ece5 --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.fr-FR.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Êtes-vous sûr de vouloir supprimer la bibliothèque spécifiée? + + + Modifier + + + Bibliothèques + + + La bibliothèque a été supprimée! + + + Aucune bibliothèque + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.it-IT.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.it-IT.resx new file mode 100644 index 00000000..6c3554c7 --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.it-IT.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + È sicuro di voler eliminare la libreria specificata? + + + Modifica + + + Librerie + + + La libreria è stata eliminata! + + + Nessuna libreria + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ja-JP.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ja-JP.resx new file mode 100644 index 00000000..549b22b9 --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ja-JP.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 指定されたライブラリを削除してもよろしいですか? + + + 編集 + + + ライブラリ + + + ライブラリが削除されました! + + + ライブラリがありません + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.resx new file mode 100644 index 00000000..e28890f7 --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Are you sure you want to delete the specified library? + + + Edit + + + Libraries + + + The library has been deleted! + + + No libraries + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ro-RO.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ro-RO.resx new file mode 100644 index 00000000..8105a7bf --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ro-RO.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Sunteți sigur că doriți să ștergeți biblioteca specificată? + + + Editează + + + Biblioteci + + + Biblioteca a fost ștearsă! + + + Nicio bibliotecă + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ru-RU.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ru-RU.resx new file mode 100644 index 00000000..7cac2e87 --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ru-RU.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Вы уверены, что хотите удалить указанную библиотеку? + + + Редактировать + + + Библиотеки + + + Библиотека удалена! + + + Нет библиотек + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.zh-CN.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.zh-CN.resx new file mode 100644 index 00000000..b6f2e4ed --- /dev/null +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.zh-CN.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 您确定要删除指定的库吗? + + + 编辑 + + + 库 + + + 库已删除! + + + 无库 + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.de-DE.resx b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.de-DE.resx index b2360164..e48e3fe3 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.de-DE.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.de-DE.resx @@ -207,4 +207,7 @@ Rollen verwalten - + + Startseite + + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.en-US.resx b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.en-US.resx index ac280756..2baa366d 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.en-US.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.en-US.resx @@ -207,4 +207,7 @@ Manage roles + + Home + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.es-ES.resx b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.es-ES.resx index 0f8f73b5..11c36f36 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.es-ES.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.es-ES.resx @@ -207,4 +207,7 @@ Administrar roles + + Inicio + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.fr-FR.resx b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.fr-FR.resx index 4f5902a6..4f51ba6a 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.fr-FR.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.fr-FR.resx @@ -207,4 +207,7 @@ Gérer les rôles + + Accueil + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.it-IT.resx b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.it-IT.resx index aadc0942..0c1c6013 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.it-IT.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.it-IT.resx @@ -207,4 +207,7 @@ Gestire i ruoli + + Home + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.ja-JP.resx b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.ja-JP.resx index fa4558e1..46cc1432 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.ja-JP.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.ja-JP.resx @@ -207,4 +207,7 @@ ロールを管理する + + ホーム + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.resx b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.resx index ac280756..2baa366d 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.resx @@ -207,4 +207,7 @@ Manage roles + + Home + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.ro-RO.resx b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.ro-RO.resx index 599c16fc..f9c37f14 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.ro-RO.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.ro-RO.resx @@ -207,4 +207,7 @@ Gestionare roluri + + Acasă + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.ru-RU.resx b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.ru-RU.resx index cac9ba6d..ff655e37 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.ru-RU.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.ru-RU.resx @@ -207,4 +207,7 @@ Управление ролями + + Главная + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.zh-CN.resx b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.zh-CN.resx index 10340b91..ee3cceed 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.zh-CN.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Shared/_NavMenu.zh-CN.resx @@ -207,4 +207,7 @@ 管理角色 + + 首页 + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Views/Home/Index.cshtml b/src/Lumina.Presentation.Web/Views/Home/Index.cshtml index b6c0cc27..96cad212 100644 --- a/src/Lumina.Presentation.Web/Views/Home/Index.cshtml +++ b/src/Lumina.Presentation.Web/Views/Home/Index.cshtml @@ -1 +1,75 @@ -@await Component.InvokeAsync("FileSystemBrowser") +@* +/ +*@ + +@using Lumina.Presentation.Web.Common.Models.Libraries +@using Lumina.Presentation.Web.Common.Services +@using Microsoft.AspNetCore.Mvc.Localization + +@{ + // generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler + var scriptId = ScriptIdentifierHelper.GenerateScriptId(); +} + +@inject IViewLocalizer _localizer +@inject IUrlService _urlService + +
+
+ +
+
+ +
+
+
+@section Scripts { + +} diff --git a/src/Lumina.Presentation.Web/Views/Library/Management/Index.cshtml b/src/Lumina.Presentation.Web/Views/Library/Management/Index.cshtml index 153c525c..c06308fe 100644 --- a/src/Lumina.Presentation.Web/Views/Library/Management/Index.cshtml +++ b/src/Lumina.Presentation.Web/Views/Library/Management/Index.cshtml @@ -1,4 +1,113 @@ @* /library/manage *@ -

libraries

+ +@using Lumina.Presentation.Web.Common.Models.Libraries +@using Lumina.Presentation.Web.Common.Services +@using Microsoft.AspNetCore.Mvc.Localization + +@{ + // generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler + var scriptId = ScriptIdentifierHelper.GenerateScriptId(); +} + +@inject IUrlService _urlService +@inject IViewLocalizer _localizer + +
+
+
+
+
+

+ @(_localizer["Libraries"]) +

+
+
+
+
+ +
+
+
+
+
+@section Scripts { + +} diff --git a/src/Lumina.Presentation.Web/Views/Library/Management/Item.cshtml b/src/Lumina.Presentation.Web/Views/Library/Management/Item.cshtml index e8eae3c0..d94b0990 100644 --- a/src/Lumina.Presentation.Web/Views/Library/Management/Item.cshtml +++ b/src/Lumina.Presentation.Web/Views/Library/Management/Item.cshtml @@ -21,7 +21,7 @@
-
+
@Html.AntiForgeryToken() @@ -231,7 +231,6 @@ } } - // on Enter key pressed const handleEnterKey = async function(e) { if (e.key === 'Enter') { diff --git a/src/Lumina.Presentation.Web/Views/Shared/_Layout.cshtml b/src/Lumina.Presentation.Web/Views/Shared/_Layout.cshtml index a1bdff7b..a827d0fc 100644 --- a/src/Lumina.Presentation.Web/Views/Shared/_Layout.cshtml +++ b/src/Lumina.Presentation.Web/Views/Shared/_Layout.cshtml @@ -1,6 +1,9 @@ +@using Lumina.Presentation.Web.Common.Models.Configuration @using Microsoft.AspNetCore.Mvc.Localization +@using Microsoft.Extensions.Options @inject IViewLocalizer _localizer +@inject IOptions _serverConfigurationModel @@ -50,6 +53,10 @@