eliminates region sections

This commit is contained in:
BinaryAlley committed 2024-10-12 22:03:57 +03:00
1 parent 705c02b90d
commit 405fc1ff9a
370 files changed
+47 -1618

No files matched your search

@@ -18,11 +18,8 @@ namespace Lumina.Application.Common.Behaviors;
public class ValidationBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> where TRequest : IRequest<TResponse>
where TResponse : IErrorOr
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IValidator<TRequest>? _validator;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="ValidationBehavior{TRequest, TResponse}"/> class.
/// </summary>
@@ -31,9 +28,7 @@ public class ValidationBehavior<TRequest, TResponse> : IPipelineBehavior<TReques
{
_validator = validator;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Pipeline handler. Perform any additional behavior and await the <paramref name="next"/> delegate as necessary.
/// </summary>
@@ -56,5 +51,4 @@ public class ValidationBehavior<TRequest, TResponse> : IPipelineBehavior<TReques
// this is acceptable because we DO know that we will always have a list of errors of type ErrorOr (check the generic constraint at the top of the class!)
return (dynamic)errors;
}
#endregion
}
@@ -13,7 +13,6 @@ namespace Lumina.Application.Common.Converters;
/// <typeparam name="TValue">The type of the value represented by the <see cref="Optional{TValue}"/> structure.</typeparam>
public class OptionalJsonConverter<TValue> : JsonConverter<Optional<TValue>>
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Reads and converts the JSON to an instance of <see cref="Optional{TValue}"/>.
/// </summary>
@@ -42,5 +41,4 @@ public class OptionalJsonConverter<TValue> : JsonConverter<Optional<TValue>>
else
writer.WriteNullValue();
}
#endregion
}
@@ -12,7 +12,6 @@ namespace Lumina.Application.Common.Converters;
/// </summary>
public class OptionalJsonConverterFactory : JsonConverterFactory
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Determines whether the converter can convert the specified type.
/// </summary>
@@ -36,5 +35,4 @@ public class OptionalJsonConverterFactory : JsonConverterFactory
typeof(OptionalJsonConverter<>).MakeGenericType(valueType))!;
return converter;
}
#endregion
}
@@ -10,11 +10,9 @@ namespace Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
/// </summary>
public interface IDeleteAllRepositoryAction
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Deletes all entities from the storage medium.
/// </summary>
/// <returns>An <see cref="ErrorOr{TValue}"/> representing either a successfull operation, or an error.</returns>
Task<ErrorOr<Deleted>> DeleteAllAsync();
#endregion
}
@@ -12,7 +12,6 @@ namespace Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
/// <typeparam name="TId">The type used for the identifier of the respository. It should not be <see langword="null"/>.</typeparam>
public interface IDeleteByIdRepositoryAction<TId> where TId : notnull
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Deletes an element identified by <paramref name="id"/> from the storage medium.
/// </summary>
@@ -20,5 +19,4 @@ public interface IDeleteByIdRepositoryAction<TId> where TId : notnull
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="ErrorOr{TValue}"/> representing either a successfull operation, or an error.</returns>
Task<ErrorOr<Deleted>> DeleteByIdAsync(TId id, CancellationToken cancellationToken);
#endregion
}
@@ -14,12 +14,10 @@ namespace Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
/// <typeparam name="TModel">The type used as a result for the "get all" action. It should implement <see cref="IStorageEntity"/>.</typeparam>
public interface IGetAllRepositoryAction<TModel> where TModel : IStorageEntity
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets all data of type <typeparamref name="TModel"/> from the storage medium.
/// </summary>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="ErrorOr{TValue}"/> containing either a collection of <typeparamref name="TModel"/>, or an error.</returns>
Task<ErrorOr<IEnumerable<TModel>>> GetAllAsync(CancellationToken cancellationToken);
#endregion
}
@@ -15,7 +15,6 @@ namespace Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
public interface IGetByIdRepositoryAction<TModel, TId> where TModel : IStorageEntity
where TId : notnull
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets an element of type <typeparamref name="TModel"/> identified by <paramref name="id"/> from the storage medium.
/// </summary>
@@ -23,5 +22,4 @@ public interface IGetByIdRepositoryAction<TModel, TId> where TModel : IStorageEn
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="ErrorOr{TValue}"/> containing either a <typeparamref name="TModel"/> identified by <paramref name="id"/>, or an error.</returns>
Task<ErrorOr<TModel?>> GetByIdAsync(TId id, CancellationToken cancellationToken);
#endregion
}
@@ -13,7 +13,6 @@ namespace Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
/// <typeparam name="TModel">The type used for the insert action. It should implement <see cref="IStorageEntity"/>.</typeparam>
public interface IInsertRepositoryAction<TModel> where TModel : IStorageEntity
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Saves an element of type <typeparamref name="TModel"/> in the storage medium.
/// </summary>
@@ -21,5 +20,4 @@ public interface IInsertRepositoryAction<TModel> where TModel : IStorageEntity
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="ErrorOr{TValue}"/> representing either a successfull operation, or an error.</returns>
Task<ErrorOr<Created>> InsertAsync(TModel data, CancellationToken cancellationToken);
#endregion
}
@@ -13,7 +13,6 @@ namespace Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
/// <typeparam name="TModel">The type used for the update action. It should implement <see cref="IStorageEntity"/>.</typeparam>
public interface IUpdateRepositoryAction<TModel> where TModel : IStorageEntity
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Updates <paramref name="data"/> in the storage medium.
/// </summary>
@@ -21,5 +20,4 @@ public interface IUpdateRepositoryAction<TModel> where TModel : IStorageEntity
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="ErrorOr{TValue}"/> representing either a successfull operation, or an error.</returns>
Task<ErrorOr<Updated>> UpdateAsync(TModel data, CancellationToken cancellationToken);
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Application.Common.DataAccess.UoW;
/// </summary>
public interface IUnitOfWork
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Exposes a repository of type <typeparamref name="TRepository"/> to the Business Layer.
/// </summary>
@@ -33,5 +32,4 @@ public interface IUnitOfWork
/// Commits a transaction.
/// </summary>
void CommitTransaction();
#endregion
}
@@ -14,7 +14,6 @@ namespace Lumina.Application.Common.DependencyInjection;
/// </summary>
public static class ApplicationLayerServices
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Registers the services of the Application layer into the dependency injection container.
/// </summary>
@@ -42,5 +41,4 @@ public static class ApplicationLayerServices
return services;
}
#endregion
}
@@ -15,7 +15,6 @@ namespace Lumina.Application.Common.Mapping.FileManagement;
/// </summary>
public class DirectoryMappingConfig : IRegister
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Registers the mapping configuration.
/// </summary>
@@ -48,5 +47,4 @@ public class DirectoryMappingConfig : IRegister
DateTime.Now
));
}
#endregion
}
@@ -11,7 +11,6 @@ namespace Lumina.Application.Common.Mapping.FileManagement;
/// </summary>
public class FileMappingConfig : IRegister
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Registers the mapping configuration.
/// </summary>
@@ -35,5 +34,4 @@ public class FileMappingConfig : IRegister
src.Size
));
}
#endregion
}
@@ -15,7 +15,6 @@ namespace Lumina.Application.Common.Mapping.FileManagement;
/// </summary>
public class FileSystemTreeMappingConfig : IRegister
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Registers the mapping configuration.
/// </summary>
@@ -63,5 +62,4 @@ public class FileSystemTreeMappingConfig : IRegister
dest.Children = [];
});
}
#endregion
}
@@ -11,7 +11,6 @@ namespace Lumina.Application.Common.Mapping.FileManagement;
/// </summary>
public class PathSegmentMappingConfig : IRegister
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Registers the mapping configuration.
/// </summary>
@@ -22,5 +21,4 @@ public class PathSegmentMappingConfig : IRegister
.Map(dest => dest.Path, src => src.Name)
.MapToConstructor(true);
}
#endregion
}
@@ -11,7 +11,6 @@ namespace Lumina.Application.Common.Mapping.FileManagement;
/// </summary>
public class ThumbnailMappingConfig : IRegister
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Registers the mapping configuration.
/// </summary>
@@ -23,5 +22,4 @@ public class ThumbnailMappingConfig : IRegister
.Map(dest => dest.Bytes, src => src.Bytes)
.MapToConstructor(true);
}
#endregion
}
@@ -20,7 +20,6 @@ namespace Lumina.Application.Common.Mapping.WrittenContentLibrary.BookLibrary;
/// </summary>
public class BookMappingConfig : IRegister
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Registers the mapping configuration.
/// </summary>
@@ -130,5 +129,4 @@ public class BookMappingConfig : IRegister
).Value).ToList()
).Value);
}
#endregion
}
@@ -18,12 +18,9 @@ namespace Lumina.Application.Core.FileManagement.Directories.Queries.GetDirector
/// </summary>
public class GetDirectoriesQueryHandler : IRequestHandler<GetDirectoriesQuery, ErrorOr<IEnumerable<DirectoryResponse>>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IDirectoryService _directoryService;
private readonly IMapper _mapper;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetDirectoriesQueryHandler"/> class.
/// </summary>
@@ -34,9 +31,7 @@ public class GetDirectoriesQueryHandler : IRequestHandler<GetDirectoriesQuery, E
_directoryService = directoryService;
_mapper = mapper;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the list of directories at the specified path.
/// </summary>
@@ -50,5 +45,4 @@ public class GetDirectoriesQueryHandler : IRequestHandler<GetDirectoriesQuery, E
ErrorOr<IEnumerable<Directory>> result = _directoryService.GetSubdirectories(request.Path, request.IncludeHiddenElements);
return ValueTask.FromResult(result.Match(values => ErrorOrFactory.From(_mapper.Map<IEnumerable<DirectoryResponse>>(values)), errors => errors));
}
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Application.Core.FileManagement.Directories.Queries.GetDirector
/// </summary>
public class GetDirectoriesQueryValidator : AbstractValidator<GetDirectoriesQuery>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetDirectoriesQueryValidator"/> class.
/// </summary>
@@ -18,5 +17,4 @@ public class GetDirectoriesQueryValidator : AbstractValidator<GetDirectoriesQuer
{
RuleFor(x => x.Path).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
}
#endregion
}
@@ -21,14 +21,11 @@ namespace Lumina.Application.Core.FileManagement.Directories.Queries.GetDirector
/// </summary>
public class GetDirectoryTreeQueryHandler : IRequestHandler<GetDirectoryTreeQuery, ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IDirectoryService _directoryService;
private readonly IFileService _fileService;
private readonly IPathService _pathService;
private readonly IDriveService _driveService;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetDirectoryTreeQueryHandler"/> class.
/// </summary>
@@ -43,9 +40,7 @@ public class GetDirectoryTreeQueryHandler : IRequestHandler<GetDirectoryTreeQuer
_pathService = pathService;
_driveService = driveService;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the tree of expanded directories leading up to the requested path, with the additional list of drives, and children of the last child directory.
/// </summary>
@@ -182,5 +177,4 @@ public class GetDirectoryTreeQueryHandler : IRequestHandler<GetDirectoryTreeQuer
node.ChildrenLoaded = true;
return Result.Success;
}
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Application.Core.FileManagement.Directories.Queries.GetDirector
/// </summary>
public class GetDirectoryTreeQueryValidator : AbstractValidator<GetDirectoryTreeQuery>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetDirectoryTreeQueryValidator"/> class.
/// </summary>
@@ -18,5 +17,4 @@ public class GetDirectoryTreeQueryValidator : AbstractValidator<GetDirectoryTree
{
RuleFor(x => x.Path).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
}
#endregion
}
@@ -18,12 +18,9 @@ namespace Lumina.Application.Core.FileManagement.Directories.Queries.GetTreeDire
/// </summary>
public class GetTreeDirectoriesQueryHandler : IRequestHandler<GetTreeDirectoriesQuery, ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IDirectoryService _directoryService;
private readonly IMapper _mapper;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetTreeDirectoriesQueryHandler"/> class.
/// </summary>
@@ -34,9 +31,7 @@ public class GetTreeDirectoriesQueryHandler : IRequestHandler<GetTreeDirectories
_directoryService = directoryService;
_mapper = mapper;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the list of directories at the specified path.
/// </summary>
@@ -50,5 +45,4 @@ public class GetTreeDirectoriesQueryHandler : IRequestHandler<GetTreeDirectories
ErrorOr<IEnumerable<Directory>> result = _directoryService.GetSubdirectories(request.Path, request.IncludeHiddenElements);
return ValueTask.FromResult(result.Match(values => ErrorOrFactory.From(_mapper.Map<IEnumerable<FileSystemTreeNodeResponse>>(values)), errors => errors));
}
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Application.Core.FileManagement.Directories.Queries.GetTreeDire
/// </summary>
public class GetTreeDirectoriesQueryValidator : AbstractValidator<GetTreeDirectoriesQuery>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetTreeDirectoriesQueryValidator"/> class.
/// </summary>
@@ -18,5 +17,4 @@ public class GetTreeDirectoriesQueryValidator : AbstractValidator<GetTreeDirecto
{
RuleFor(x => x.Path).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
}
#endregion
}
@@ -18,12 +18,9 @@ namespace Lumina.Application.Core.FileManagement.Drives.Queries.GetDrives;
/// </summary>
public class GetDrivesQueryHandler : IRequestHandler<GetDrivesQuery, ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IDriveService _driveService;
private readonly IMapper _mapper;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetDrivesQueryHandler"/> class.
/// </summary>
@@ -34,9 +31,7 @@ public class GetDrivesQueryHandler : IRequestHandler<GetDrivesQuery, ErrorOr<IEn
_driveService = driveService;
_mapper = mapper;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the list of file system drives.
/// </summary>
@@ -50,5 +45,4 @@ public class GetDrivesQueryHandler : IRequestHandler<GetDrivesQuery, ErrorOr<IEn
ErrorOr<IEnumerable<FileSystemItem>> result = _driveService.GetDrives();
return ValueTask.FromResult(result.Match(values => ErrorOrFactory.From(_mapper.Map<IEnumerable<FileSystemTreeNodeResponse>>(values)), errors => errors));
}
#endregion
}
@@ -13,11 +13,8 @@ namespace Lumina.Application.Core.FileManagement.FileSystem.Queries.GetFileSyste
/// </summary>
public class GetFileSystemQueryHandler : IRequestHandler<GetFileSystemQuery, FileSystemTypeResponse>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IPlatformContext _platformContext;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetFileSystemQueryHandler"/> class.
/// </summary>
@@ -26,9 +23,7 @@ public class GetFileSystemQueryHandler : IRequestHandler<GetFileSystemQuery, Fil
{
_platformContext = platformContextManager.GetCurrentContext();
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the type of the file system.
/// </summary>
@@ -39,5 +34,4 @@ public class GetFileSystemQueryHandler : IRequestHandler<GetFileSystemQuery, Fil
{
return ValueTask.FromResult(new FileSystemTypeResponse(_platformContext.Platform));
}
#endregion
}
@@ -18,12 +18,9 @@ namespace Lumina.Application.Core.FileManagement.Files.Queries.GetFiles;
/// </summary>
public class GetFilesQueryHandler : IRequestHandler<GetFilesQuery, ErrorOr<IEnumerable<FileResponse>>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IFileService _fileService;
private readonly IMapper _mapper;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetFilesQueryHandler"/> class.
/// </summary>
@@ -34,9 +31,7 @@ public class GetFilesQueryHandler : IRequestHandler<GetFilesQuery, ErrorOr<IEnum
_fileService = fileService;
_mapper = mapper;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the list of files at the specified path.
/// </summary>
@@ -50,5 +45,4 @@ public class GetFilesQueryHandler : IRequestHandler<GetFilesQuery, ErrorOr<IEnum
ErrorOr<IEnumerable<File>> result = _fileService.GetFiles(request.Path, request.IncludeHiddenElements);
return ValueTask.FromResult(result.Match(values => ErrorOrFactory.From(_mapper.Map<IEnumerable<FileResponse>>(values)), errors => errors));
}
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Application.Core.FileManagement.Files.Queries.GetFiles;
/// </summary>
public class GetFilesQueryValidator : AbstractValidator<GetFilesQuery>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetFilesQueryValidator"/> class.
/// </summary>
@@ -18,5 +17,4 @@ public class GetFilesQueryValidator : AbstractValidator<GetFilesQuery>
{
RuleFor(x => x.Path).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
}
#endregion
}
@@ -18,12 +18,9 @@ namespace Lumina.Application.Core.FileManagement.Files.Queries.GetTreeFiles;
/// </summary>
public class GetTreeFilesQueryHandler : IRequestHandler<GetTreeFilesQuery, ErrorOr<IEnumerable<FileSystemTreeNodeResponse>>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IFileService _fileService;
private readonly IMapper _mapper;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetTreeFilesQueryHandler"/> class.
/// </summary>
@@ -34,9 +31,7 @@ public class GetTreeFilesQueryHandler : IRequestHandler<GetTreeFilesQuery, Error
_fileService = fileService;
_mapper = mapper;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the list of files at the specified path.
/// </summary>
@@ -50,5 +45,4 @@ public class GetTreeFilesQueryHandler : IRequestHandler<GetTreeFilesQuery, Error
ErrorOr<IEnumerable<File>> result = _fileService.GetFiles(request.Path, request.IncludeHiddenElements);
return ValueTask.FromResult(result.Match(values => ErrorOrFactory.From(_mapper.Map<IEnumerable<FileSystemTreeNodeResponse>>(values)), errors => errors));
}
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Application.Core.FileManagement.Files.Queries.GetTreeFiles;
/// </summary>
public class GetTreeFilesQueryValidator : AbstractValidator<GetTreeFilesQuery>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetTreeFilesQueryValidator"/> class.
/// </summary>
@@ -18,5 +17,4 @@ public class GetTreeFilesQueryValidator : AbstractValidator<GetTreeFilesQuery>
{
RuleFor(x => x.Path).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
}
#endregion
}
@@ -15,11 +15,8 @@ namespace Lumina.Application.Core.FileManagement.Paths.Commands.CombinePath;
/// </summary>
public class CombinePathCommandHandler : IRequestHandler<CombinePathCommand, ErrorOr<PathSegmentResponse>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IPathService _pathService;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="SplitPathCommandHandler"/> class.
/// </summary>
@@ -28,9 +25,7 @@ public class CombinePathCommandHandler : IRequestHandler<CombinePathCommand, Err
{
_pathService = pathService;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Combines two file system paths.
/// </summary>
@@ -44,5 +39,4 @@ public class CombinePathCommandHandler : IRequestHandler<CombinePathCommand, Err
ErrorOr<string> result = _pathService.CombinePath(request.OriginalPath, request.NewPath);
return ValueTask.FromResult(result.Match(values => ErrorOrFactory.From(new PathSegmentResponse(result.Value)), errors => errors));
}
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Application.Core.FileManagement.Paths.Commands.CombinePath;
/// </summary>
public class CombinePathCommandValidator : AbstractValidator<CombinePathCommand>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="CombinePathCommandValidator"/> class.
/// </summary>
@@ -19,5 +18,4 @@ public class CombinePathCommandValidator : AbstractValidator<CombinePathCommand>
RuleFor(x => x.OriginalPath).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
RuleFor(x => x.NewPath).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
}
#endregion
}
@@ -17,12 +17,9 @@ namespace Lumina.Application.Core.FileManagement.Paths.Commands.SplitPath;
/// </summary>
public class SplitPathCommandHandler : IRequestHandler<SplitPathCommand, ErrorOr<IEnumerable<PathSegmentResponse>>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IPathService _pathService;
private readonly IMapper _mapper;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="SplitPathCommandHandler"/> class.
/// </summary>
@@ -33,9 +30,7 @@ public class SplitPathCommandHandler : IRequestHandler<SplitPathCommand, ErrorOr
_pathService = pathService;
_mapper = mapper;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the path components of the specified path.
/// </summary>
@@ -49,5 +44,4 @@ public class SplitPathCommandHandler : IRequestHandler<SplitPathCommand, ErrorOr
ErrorOr<IEnumerable<PathSegment>> result = _pathService.ParsePath(request.Path);
return ValueTask.FromResult(result.Match(values => ErrorOrFactory.From(_mapper.Map<IEnumerable<PathSegmentResponse>>(values)), errors => errors));
}
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Application.Core.FileManagement.Paths.Commands.SplitPath;
/// </summary>
public class SplitPathCommandValidator : AbstractValidator<SplitPathCommand>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="SplitPathCommandValidator"/> class.
/// </summary>
@@ -18,5 +17,4 @@ public class SplitPathCommandValidator : AbstractValidator<SplitPathCommand>
{
RuleFor(x => x.Path).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
}
#endregion
}
@@ -13,11 +13,8 @@ namespace Lumina.Application.Core.FileManagement.Paths.Queries.CheckPathExists;
/// </summary>
public class CheckPathExistsQueryHandler : IRequestHandler<CheckPathExistsQuery, PathExistsResponse>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IPathService _pathService;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="CheckPathExistsQueryHandler"/> class.
/// </summary>
@@ -26,9 +23,7 @@ public class CheckPathExistsQueryHandler : IRequestHandler<CheckPathExistsQuery,
{
_pathService = pathService;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Checks the existence of the specified file system path.
/// </summary>
@@ -41,5 +36,4 @@ public class CheckPathExistsQueryHandler : IRequestHandler<CheckPathExistsQuery,
{
return ValueTask.FromResult(new PathExistsResponse(_pathService.Exists(request.Path, request.IncludeHiddenElements)));
}
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Application.Core.FileManagement.Paths.Queries.CheckPathExists;
/// </summary>
public class CheckPathExistsQueryValidator : AbstractValidator<CheckPathExistsQuery>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="CheckPathExistsQueryValidator"/> class.
/// </summary>
@@ -18,5 +17,4 @@ public class CheckPathExistsQueryValidator : AbstractValidator<CheckPathExistsQu
{
RuleFor(x => x.Path).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
}
#endregion
}
@@ -17,12 +17,9 @@ namespace Lumina.Application.Core.FileManagement.Paths.Queries.GetPathParent;
/// </summary>
public class GetPathParentQueryHandler : IRequestHandler<GetPathParentQuery, ErrorOr<IEnumerable<PathSegmentResponse>>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IPathService _pathService;
private readonly IMapper _mapper;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetPathParentQueryHandler"/> class.
/// </summary>
@@ -33,9 +30,7 @@ public class GetPathParentQueryHandler : IRequestHandler<GetPathParentQuery, Err
_pathService = pathService;
_mapper = mapper;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the parent of the specified file system path.
/// </summary>
@@ -49,5 +44,4 @@ public class GetPathParentQueryHandler : IRequestHandler<GetPathParentQuery, Err
ErrorOr<IEnumerable<PathSegment>> result = _pathService.GoUpOneLevel(request.Path);
return ValueTask.FromResult(result.Match(values => ErrorOrFactory.From(_mapper.Map<IEnumerable<PathSegmentResponse>>(values)), errors => errors));
}
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Application.Core.FileManagement.Paths.Queries.GetPathParent;
/// </summary>
public class GetPathParentQueryValidator : AbstractValidator<GetPathParentQuery>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetPathParentQueryValidator"/> class.
/// </summary>
@@ -18,5 +17,4 @@ public class GetPathParentQueryValidator : AbstractValidator<GetPathParentQuery>
{
RuleFor(x => x.Path).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
}
#endregion
}
@@ -16,12 +16,9 @@ namespace Lumina.Application.Core.FileManagement.Paths.Queries.GetPathRoot;
/// </summary>
public class GetPathRootQueryHandler : IRequestHandler<GetPathRootQuery, ErrorOr<PathSegmentResponse>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IPathService _pathService;
private readonly IMapper _mapper;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetPathRootQueryHandler"/> class.
/// </summary>
@@ -32,9 +29,7 @@ public class GetPathRootQueryHandler : IRequestHandler<GetPathRootQuery, ErrorOr
_pathService = pathService;
_mapper = mapper;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the root of the specified file system path.
/// </summary>
@@ -46,5 +41,4 @@ public class GetPathRootQueryHandler : IRequestHandler<GetPathRootQuery, ErrorOr
ErrorOr<PathSegment> result = _pathService.GetPathRoot(request.Path);
return ValueTask.FromResult(result.Match(values => ErrorOrFactory.From(_mapper.Map<PathSegmentResponse>(values)), errors => errors));
}
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Application.Core.FileManagement.Paths.Queries.GetPathRoot;
/// </summary>
public class GetPathRootQueryValidator : AbstractValidator<GetPathRootQuery>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetPathRootQueryValidator"/> class.
/// </summary>
@@ -18,5 +17,4 @@ public class GetPathRootQueryValidator : AbstractValidator<GetPathRootQuery>
{
RuleFor(x => x.Path).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
}
#endregion
}
@@ -13,11 +13,8 @@ namespace Lumina.Application.Core.FileManagement.Paths.Queries.GetPathSeparator;
/// </summary>
public class GetPathSeparatorQueryHandler : IRequestHandler<GetPathSeparatorQuery, PathSeparatorResponse>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IPathService _pathService;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetPathSeparatorQueryHandler"/> class.
/// </summary>
@@ -26,9 +23,7 @@ public class GetPathSeparatorQueryHandler : IRequestHandler<GetPathSeparatorQuer
{
_pathService = pathService;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the path separator character of a file system path.
/// </summary>
@@ -39,5 +34,4 @@ public class GetPathSeparatorQueryHandler : IRequestHandler<GetPathSeparatorQuer
{
return ValueTask.FromResult(new PathSeparatorResponse(_pathService.PathSeparator.ToString()));
}
#endregion
}
@@ -13,11 +13,8 @@ namespace Lumina.Application.Core.FileManagement.Paths.Queries.ValidatePath;
/// </summary>
public class ValidatePathQueryHandler : IRequestHandler<ValidatePathQuery, PathValidResponse>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IPathService _pathService;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="ValidatePathQueryHandler"/> class.
/// </summary>
@@ -26,9 +23,7 @@ public class ValidatePathQueryHandler : IRequestHandler<ValidatePathQuery, PathV
{
_pathService = pathService;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Validates the specified file system path.
/// </summary>
@@ -41,5 +36,4 @@ public class ValidatePathQueryHandler : IRequestHandler<ValidatePathQuery, PathV
{
return ValueTask.FromResult(new PathValidResponse(_pathService.IsValidPath(request.Path)));
}
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Application.Core.FileManagement.Paths.Queries.ValidatePath;
/// </summary>
public class ValidatePathQueryValidator : AbstractValidator<ValidatePathQuery>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="ValidatePathQueryValidator"/> class.
/// </summary>
@@ -18,5 +17,4 @@ public class ValidatePathQueryValidator : AbstractValidator<ValidatePathQuery>
{
RuleFor(x => x.Path).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
}
#endregion
}
@@ -16,12 +16,9 @@ namespace Lumina.Application.Core.FileManagement.Thumbnails.Queries.GetThumbnail
/// </summary>
public class GetThumbnailQueryHandler : IRequestHandler<GetThumbnailQuery, ErrorOr<ThumbnailResponse>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IThumbnailService _thumbnailsService;
private readonly IMapper _mapper;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetThumbnailQueryHandler"/> class.
/// </summary>
@@ -32,9 +29,7 @@ public class GetThumbnailQueryHandler : IRequestHandler<GetThumbnailQuery, Error
_thumbnailsService = thumbnailsService;
_mapper = mapper;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the thumbnail for a file located at the specified path, with the specified quality.
/// </summary>
@@ -46,5 +41,4 @@ public class GetThumbnailQueryHandler : IRequestHandler<GetThumbnailQuery, Error
ErrorOr<Thumbnail> result = await _thumbnailsService.GetThumbnailAsync(request.Path, request.Quality, cancellationToken);
return await ValueTask.FromResult(result.Match(values => ErrorOrFactory.From(_mapper.Map<ThumbnailResponse>(values)), errors => errors));
}
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Application.Core.FileManagement.Thumbnails.Queries.GetThumbnail
/// </summary>
public class GetThumbnailQueryValidator : AbstractValidator<GetThumbnailQuery>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetThumbnailQueryValidator"/> class.
/// </summary>
@@ -19,5 +18,4 @@ public class GetThumbnailQueryValidator : AbstractValidator<GetThumbnailQuery>
RuleFor(x => x.Path).NotEmpty().WithMessage(Errors.FileManagement.PathCannotBeEmpty.Code);
RuleFor(x => x.Quality).InclusiveBetween(0, 100).WithMessage(Errors.Thumbnails.ImageQaulityMustBeBetweenZeroAndOneHundred.Code);
}
#endregion
}
@@ -27,12 +27,9 @@ namespace Lumina.Application.Core.WrittenContentLibrary.BooksLibrary.Books.Comma
/// </summary>
public class AddBookCommandHandler : IRequestHandler<AddBookCommand, ErrorOr<Book>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IUnitOfWork _unitOfWork;
private readonly IMapper _mapper;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="AddBookCommandHandler"/> class.
/// </summary>
@@ -43,9 +40,7 @@ public class AddBookCommandHandler : IRequestHandler<AddBookCommand, ErrorOr<Boo
_unitOfWork = unitOfWork;
_mapper = mapper;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Handles the command to add a book.
/// </summary>
@@ -176,5 +171,4 @@ public class AddBookCommandHandler : IRequestHandler<AddBookCommand, ErrorOr<Boo
return createBookResult.Value;
}
#endregion
}
@@ -11,7 +11,6 @@ namespace Lumina.Application.Core.WrittenContentLibrary.BooksLibrary.Books.Comma
/// </summary>
public class AddBookCommandValidator : AbstractValidator<AddBookCommand>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="AddBookCommandValidator"/> class.
/// </summary>
@@ -211,5 +210,4 @@ public class AddBookCommandValidator : AbstractValidator<AddBookCommand>
.WithMessage(Errors.Metadata.RatingVoteCountMustBePositive.Code);
});
}
#endregion
}
@@ -18,11 +18,8 @@ namespace Lumina.Application.Core.WrittenContentLibrary.BooksLibrary.Books.Queri
/// </summary>
public class GetBooksQueryHandler : IRequestHandler<GetBooksQuery, ErrorOr<IEnumerable<Book>>>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IUnitOfWork _unitOfWork;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="GetBooksQueryHandler"/> class.
/// </summary>
@@ -31,9 +28,7 @@ public class GetBooksQueryHandler : IRequestHandler<GetBooksQuery, ErrorOr<IEnum
{
_unitOfWork = unitOfWork;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Handles the query to get all books.
/// </summary>
@@ -48,5 +43,4 @@ public class GetBooksQueryHandler : IRequestHandler<GetBooksQuery, ErrorOr<IEnum
ErrorOr<IEnumerable<BookModel>> getBooksResult = await bookRepository.GetAllAsync(cancellationToken).ConfigureAwait(false);
return getBooksResult.Match(values => ErrorOrFactory.From(values.Adapt<IEnumerable<Book>>()), errors => errors);
}
#endregion
}