mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 23:01:10 +00:00
eliminates region sections
This commit is contained in:
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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-6
@@ -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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-6
@@ -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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-6
@@ -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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-6
@@ -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
|
||||
}
|
||||
-6
@@ -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
|
||||
}
|
||||
-6
@@ -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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-6
@@ -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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-6
@@ -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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-6
@@ -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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-6
@@ -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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-6
@@ -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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-6
@@ -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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-6
@@ -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
|
||||
}
|
||||
-6
@@ -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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-6
@@ -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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-6
@@ -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
|
||||
}
|
||||
-2
@@ -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
|
||||
}
|
||||
-6
@@ -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
|
||||
}
|
||||
@@ -9,7 +9,6 @@ namespace Lumina.Contracts.Models.Common;
|
||||
/// </summary>
|
||||
public interface IStorageEntity
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets or sets the identifier of the entity.
|
||||
/// </summary>
|
||||
@@ -24,5 +23,4 @@ public interface IStorageEntity
|
||||
/// The time and date when the entity was updated.
|
||||
/// </summary>
|
||||
DateTime? Updated { get; set; }
|
||||
#endregion
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
@@ -13,4 +13,9 @@ namespace Lumina.Contracts.Models.FileManagement;
|
||||
/// <param name="DateCreated">The creation date of the file system item.</param>
|
||||
/// <param name="DateModified">The modification date of the file system item.</param>
|
||||
[DebuggerDisplay("{Name}")]
|
||||
public record FileSystemItemModel(string Path, string Name, DateTime DateCreated, DateTime DateModified);
|
||||
public record FileSystemItemModel(
|
||||
string Path,
|
||||
string Name,
|
||||
DateTime DateCreated,
|
||||
DateTime DateModified
|
||||
);
|
||||
@@ -13,7 +13,6 @@ namespace Lumina.Contracts.Models.WrittenContentLibrary.BookLibrary;
|
||||
[DebuggerDisplay("{Title}")]
|
||||
public class BookModel : IStorageEntity
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the Id of the media item.
|
||||
/// </summary>
|
||||
@@ -204,5 +203,4 @@ public class BookModel : IStorageEntity
|
||||
/// Gets the optional time and date when the entity was updated.
|
||||
/// </summary>
|
||||
public DateTime? Updated { get; set; }
|
||||
#endregion
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Models.FileManagement;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -16,4 +16,10 @@ namespace Lumina.Contracts.Responses.FileManagement;
|
||||
/// <param name="DateModified">The modification date of the directory.</param>
|
||||
/// <param name="Items">The children items of the directory.</param>
|
||||
[DebuggerDisplay("{Name} (Directory)")]
|
||||
public record DirectoryResponse(string Path, string Name, DateTime DateCreated, DateTime DateModified, List<FileSystemItemModel> Items) : FileSystemItemModel(Path, Name, DateCreated, DateModified);
|
||||
public record DirectoryResponse(
|
||||
string Path,
|
||||
string Name,
|
||||
DateTime DateCreated,
|
||||
DateTime DateModified,
|
||||
List<FileSystemItemModel> Items
|
||||
) : FileSystemItemModel(Path, Name, DateCreated, DateModified);
|
||||
@@ -1,4 +1,4 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Models.FileManagement;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
@@ -15,4 +15,10 @@ namespace Lumina.Contracts.Responses.FileManagement;
|
||||
/// <param name="DateModified">The modification date of the file.</param>
|
||||
/// <param name="Size">The size of the file, in bytes.</param>
|
||||
[DebuggerDisplay("{Name} (File, Size: {Size} bytes)")]
|
||||
public record FileResponse(string Path, string Name, DateTime DateCreated, DateTime DateModified, long Size) : FileSystemItemModel(Path, Name, DateCreated, DateModified);
|
||||
public record FileResponse(
|
||||
string Path,
|
||||
string Name,
|
||||
DateTime DateCreated,
|
||||
DateTime DateModified,
|
||||
long Size
|
||||
) : FileSystemItemModel(Path, Name, DateCreated, DateModified);
|
||||
@@ -12,7 +12,6 @@ namespace Lumina.Contracts.Responses.FileManagement;
|
||||
[DebuggerDisplay("{Path}")]
|
||||
public class FileSystemTreeNodeResponse
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets or sets the full path of the file or directory.
|
||||
/// </summary>
|
||||
@@ -42,5 +41,4 @@ public class FileSystemTreeNodeResponse
|
||||
/// Gets or sets the list of child nodes.
|
||||
/// </summary>
|
||||
public List<FileSystemTreeNodeResponse> Children { get; set; } = [];
|
||||
#endregion
|
||||
}
|
||||
@@ -11,4 +11,7 @@ namespace Lumina.Contracts.Responses.FileManagement;
|
||||
/// <param name="Type">The type of the thumbnail image.</param>
|
||||
/// <param name="Bytes">The bytes representing the thumbail.</param>
|
||||
[DebuggerDisplay("{Type}")]
|
||||
public record ThumbnailResponse(ImageType Type, byte[] Bytes);
|
||||
public record ThumbnailResponse(
|
||||
ImageType Type,
|
||||
byte[] Bytes
|
||||
);
|
||||
@@ -13,7 +13,6 @@ namespace Lumina.DataAccess.Common.Configuration;
|
||||
/// </summary>
|
||||
public class BookConfiguration : IEntityTypeConfiguration<BookModel>
|
||||
{
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Configures the <see cref="BookModel"/> entity.
|
||||
/// </summary>
|
||||
@@ -148,7 +147,6 @@ public class BookConfiguration : IEntityTypeConfiguration<BookModel>
|
||||
.IsRequired();
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
//public class ContributorConfiguration : IEntityTypeConfiguration<ContributorIdModel>
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace Lumina.DataAccess.Common.Configuration;
|
||||
/// </summary>
|
||||
public class GenreConfiguration : IEntityTypeConfiguration<GenreModel>
|
||||
{
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Configures the <see cref="GenreModel"/> entity.
|
||||
/// </summary>
|
||||
@@ -22,5 +21,4 @@ public class GenreConfiguration : IEntityTypeConfiguration<GenreModel>
|
||||
builder.HasKey(genre => genre.Name);
|
||||
builder.Property(genre => genre.Name).IsRequired().HasMaxLength(50);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -11,7 +11,6 @@ namespace Lumina.DataAccess.Common.Configuration;
|
||||
/// </summary>
|
||||
public class TagConfiguration : IEntityTypeConfiguration<TagModel>
|
||||
{
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Configures the <see cref="TagModel"/> entity.
|
||||
/// </summary>
|
||||
@@ -22,5 +21,4 @@ public class TagConfiguration : IEntityTypeConfiguration<TagModel>
|
||||
builder.HasKey(tag => tag.Name);
|
||||
builder.Property(tag => tag.Name).IsRequired().HasMaxLength(50);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -19,7 +19,6 @@ namespace Lumina.DataAccess.Common.DependencyInjection;
|
||||
/// </summary>
|
||||
public static class DataAccessLayerServices
|
||||
{
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Extension method for adding the DataAccess layer services to the DI container.
|
||||
/// </summary>
|
||||
@@ -57,5 +56,4 @@ public static class DataAccessLayerServices
|
||||
.First(), type);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -19,11 +19,8 @@ namespace Lumina.DataAccess.Core.Repositories.Books;
|
||||
/// </summary>
|
||||
internal sealed class BookRepository : IBookRepository
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly LuminaDbContext _luminaDbContext;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BookRepository"/> class.
|
||||
/// </summary>
|
||||
@@ -32,9 +29,7 @@ internal sealed class BookRepository : IBookRepository
|
||||
{
|
||||
_luminaDbContext = luminaDbContext;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Adds a new book.
|
||||
/// </summary>
|
||||
@@ -77,5 +72,4 @@ internal sealed class BookRepository : IBookRepository
|
||||
.Include(book => book.ISBNs)
|
||||
.ToListAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -5,12 +5,10 @@
|
||||
/// </summary>
|
||||
public interface IRepositoryFactory
|
||||
{
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Creates a new repository of type <typeparamref name="TResult"/>.
|
||||
/// </summary>
|
||||
/// <typeparam name="TResult">The type of repository to create.</typeparam>
|
||||
/// <returns>A repository of type <typeparamref name="TResult"/>.</returns>
|
||||
TResult CreateRepository<TResult>() where TResult : notnull;
|
||||
#endregion
|
||||
}
|
||||
@@ -12,18 +12,13 @@ namespace Lumina.DataAccess.Core.Repositories.Common.Factory;
|
||||
/// </summary>
|
||||
public class RepositoryDictionary
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly List<KeyValuePair<Type, object>> _container = [];
|
||||
#endregion
|
||||
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the number of added repositories.
|
||||
/// </summary>
|
||||
public int Count => _container.Count;
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Resets the collection of repositories.
|
||||
/// </summary>
|
||||
@@ -66,5 +61,4 @@ public class RepositoryDictionary
|
||||
{
|
||||
return (TResult)_container.FirstOrDefault(e => e.Key == key).Value;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -10,11 +10,8 @@ namespace Lumina.DataAccess.Core.Repositories.Common.Factory;
|
||||
/// </summary>
|
||||
public class RepositoryFactory : IRepositoryFactory
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RepositoryFactory"/> class.
|
||||
/// </summary>
|
||||
@@ -23,9 +20,7 @@ public class RepositoryFactory : IRepositoryFactory
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Creates a new repository of type <typeparamref name="TResult"/>.
|
||||
/// </summary>
|
||||
@@ -36,5 +31,4 @@ public class RepositoryFactory : IRepositoryFactory
|
||||
{
|
||||
return _serviceProvider.GetRequiredService<TResult>() ?? throw new ArgumentException();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -18,11 +18,8 @@ namespace Lumina.DataAccess.Core.UoW;
|
||||
/// <remarks>To update the database: update-database -p Lumina.DataAccess -s Lumina.Presentation.Api</remarks>
|
||||
public class LuminaDbContext : DbContext
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
public virtual DbSet<BookModel> Books { get; set; } = null!;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LuminaDbContext"/> class.
|
||||
/// </summary>
|
||||
@@ -30,9 +27,7 @@ public class LuminaDbContext : DbContext
|
||||
public LuminaDbContext(DbContextOptions<LuminaDbContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Configures the entity mappings for the database context.
|
||||
/// </summary>
|
||||
@@ -67,5 +62,4 @@ public class LuminaDbContext : DbContext
|
||||
}
|
||||
return base.SaveChanges();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -17,19 +17,14 @@ namespace Lumina.DataAccess.Core.UoW;
|
||||
/// </summary>
|
||||
public class UnitOfWork : IUnitOfWork
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly LuminaDbContext _luminaDbContext;
|
||||
private readonly IRepositoryFactory _repositoryFactory;
|
||||
#endregion
|
||||
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets or sets the collection of available repositories.
|
||||
/// </summary>
|
||||
internal RepositoryDictionary Repositories { get; private set; } = new RepositoryDictionary();
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UnitOfWork"/> class.
|
||||
/// </summary>
|
||||
@@ -41,9 +36,7 @@ public class UnitOfWork : IUnitOfWork
|
||||
_luminaDbContext = luminaDbContext;
|
||||
AddRepositories();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Adds all the repositories from the Data Access Layer so that they can be exposed to the Business Layer.
|
||||
/// </summary>
|
||||
@@ -121,5 +114,4 @@ public class UnitOfWork : IUnitOfWork
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -16,7 +16,6 @@ namespace Lumina.Domain.Common.DependencyInjection;
|
||||
/// </summary>
|
||||
public static class DomainLayerServices
|
||||
{
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Registers the services of the Domain layer into the dependency injection container.
|
||||
/// </summary>
|
||||
@@ -44,5 +43,4 @@ public static class DomainLayerServices
|
||||
services.AddSingleton<IFileSystem, FileSystem>();
|
||||
return services;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -11,7 +11,6 @@ public static partial class Errors
|
||||
{
|
||||
public static class FileManagement
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
public static Error ParentNodeCannotBeNull => Error.Failure(nameof(ParentNodeCannotBeNull));
|
||||
public static Error FileCopyError => Error.Failure(nameof(FileCopyError));
|
||||
public static Error FileMoveError => Error.Failure(nameof(FileMoveError));
|
||||
@@ -29,6 +28,5 @@ public static partial class Errors
|
||||
public static Error FileAlreadyExists => Error.Conflict(nameof(FileAlreadyExists));
|
||||
public static Error DirectoryNotFound => Error.NotFound(nameof(DirectoryNotFound));
|
||||
public static Error DirectoryAlreadyExists => Error.Conflict(nameof(DirectoryAlreadyExists));
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,7 @@ namespace Lumina.Domain.Common.Errors;
|
||||
public static partial class Errors
|
||||
{
|
||||
public static class MediaContributor
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
|
||||
{
|
||||
public static Error ContributorsListCannotBeNull => Error.Validation(nameof(ContributorsListCannotBeNull));
|
||||
public static Error ContributorNameCannotBeEmpty => Error.Validation(nameof(ContributorNameCannotBeEmpty));
|
||||
public static Error ContributorDisplayNameCannotBeEmpty => Error.Validation(nameof(ContributorDisplayNameCannotBeEmpty));
|
||||
@@ -23,6 +21,5 @@ public static partial class Errors
|
||||
public static Error RoleCategoryCannotBeEmpty => Error.Validation(nameof(RoleCategoryCannotBeEmpty));
|
||||
public static Error RoleCategoryMustBeMaximum50CharactersLong => Error.Validation(nameof(RoleCategoryMustBeMaximum50CharactersLong));
|
||||
public static Error ContributorRoleCannotBeNull => Error.Validation(nameof(ContributorRoleCannotBeNull));
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,6 @@ public static partial class Errors
|
||||
{
|
||||
public static class Metadata
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
public static Error MetadataCannotBeNull => Error.Validation(nameof(MetadataCannotBeNull));
|
||||
public static Error TitleCannotBeEmpty => Error.Validation(nameof(TitleCannotBeEmpty));
|
||||
public static Error TitleMustBeMaximum255CharactersLong => Error.Validation(nameof(TitleMustBeMaximum255CharactersLong));
|
||||
@@ -43,6 +42,5 @@ public static partial class Errors
|
||||
public static Error RatingVoteCountMustBePositive => Error.Validation(nameof(RatingVoteCountMustBePositive));
|
||||
public static Error RatingsListCannotBeNull => Error.Validation(nameof(RatingsListCannotBeNull));
|
||||
public static Error InvalidIsoCode => Error.Validation(nameof(InvalidIsoCode));
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
#endregion
|
||||
|
||||
@@ -11,8 +11,6 @@ public static partial class Errors
|
||||
{
|
||||
public static class Permission
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
public static Error UnauthorizedAccess => Error.Failure(nameof(UnauthorizedAccess));
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,9 +11,7 @@ public static partial class Errors
|
||||
{
|
||||
public static class Thumbnails
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
public static Error NoThumbnail => Error.Failure(nameof(NoThumbnail));
|
||||
public static Error ImageQaulityMustBeBetweenZeroAndOneHundred => Error.Validation(nameof(ImageQaulityMustBeBetweenZeroAndOneHundred));
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,6 @@ public static partial class Errors
|
||||
{
|
||||
public static class WrittenContent
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
public static Error BookAlreadyExists => Error.Conflict(nameof(BookAlreadyExists));
|
||||
public static Error IsbnValueCannotBeEmpty => Error.Validation(nameof(IsbnValueCannotBeEmpty));
|
||||
public static Error IsbnListCannotBeNull => Error.Validation(nameof(IsbnListCannotBeNull));
|
||||
@@ -36,6 +35,5 @@ public static partial class Errors
|
||||
public static Error UnknownBookFormat => Error.Validation(nameof(UnknownBookFormat));
|
||||
public static Error EditionMustBeMaximum50CharactersLong => Error.Validation(nameof(EditionMustBeMaximum50CharactersLong));
|
||||
public static Error VolumeNumberMustBeGreaterThanZero => Error.Validation(nameof(VolumeNumberMustBeGreaterThanZero));
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ namespace Lumina.Domain.Common.Events;
|
||||
/// </summary>
|
||||
public interface IDomainEvent
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the id of the domain event.
|
||||
/// </summary>
|
||||
@@ -19,5 +18,4 @@ public interface IDomainEvent
|
||||
/// Gets the date and time when the domain event occurred.
|
||||
/// </summary>
|
||||
DateTime OccurredOn { get; }
|
||||
#endregion
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
/// <typeparam name="TId">The type representing the unique identifier for the Aggregate Root. It should be a non-nullable type.</typeparam>
|
||||
public abstract class AggregateRoot<TId> : Entity<TId> where TId : notnull
|
||||
{
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AggregateRoot{TId}"/> class.
|
||||
/// </summary>
|
||||
@@ -25,5 +24,4 @@ public abstract class AggregateRoot<TId> : Entity<TId> where TId : notnull
|
||||
|
||||
}
|
||||
#pragma warning restore CS8618
|
||||
#endregion
|
||||
}
|
||||
@@ -10,7 +10,6 @@ namespace Lumina.Domain.Common.Models.Core;
|
||||
/// <typeparam name="TId">The type representing the unique identifier for the Entity. It should be a non-nullable type.</typeparam>
|
||||
public abstract class Entity<TId> : IEquatable<Entity<TId>> where TId : notnull
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the unique identifier of the entity.
|
||||
/// </summary>
|
||||
@@ -25,9 +24,7 @@ public abstract class Entity<TId> : IEquatable<Entity<TId>> where TId : notnull
|
||||
/// Gets the date and time when the entity was last updated.
|
||||
/// </summary>
|
||||
public DateTime? Updated { get; set; }
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Entity{TId}"/> class.
|
||||
/// </summary>
|
||||
@@ -46,9 +43,7 @@ public abstract class Entity<TId> : IEquatable<Entity<TId>> where TId : notnull
|
||||
|
||||
}
|
||||
#pragma warning restore CS8618
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Indicates whether the current object is equal to another object of the same type.
|
||||
/// </summary>
|
||||
@@ -99,5 +94,4 @@ public abstract class Entity<TId> : IEquatable<Entity<TId>> where TId : notnull
|
||||
{
|
||||
return Id.GetHashCode();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -12,14 +12,11 @@ namespace Lumina.Domain.Common.Models.Core;
|
||||
[DebuggerDisplay("{Value}")]
|
||||
public abstract class EntityId<TId> : ValueObject
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the value representing the entity identifier.
|
||||
/// </summary>
|
||||
public TId Value { get; }
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EntityId{TId}"/> class.
|
||||
/// </summary>
|
||||
@@ -37,9 +34,7 @@ public abstract class EntityId<TId> : ValueObject
|
||||
{
|
||||
}
|
||||
#pragma warning restore CS8618
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Gets the list of items that define equality of the object.
|
||||
/// </summary>
|
||||
@@ -57,5 +52,4 @@ public abstract class EntityId<TId> : ValueObject
|
||||
{
|
||||
return Value?.ToString() ?? base.ToString();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -11,7 +11,6 @@ namespace Lumina.Domain.Common.Models.Core;
|
||||
/// </summary>
|
||||
public abstract class ValueObject : IEquatable<ValueObject>
|
||||
{
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Gets the list of items that define equality of the object.
|
||||
/// </summary>
|
||||
@@ -72,5 +71,4 @@ public abstract class ValueObject : IEquatable<ValueObject>
|
||||
return GetEqualityComponents().Select(x => x?.GetHashCode() ?? 0)
|
||||
.Aggregate((x, y) => x ^ y);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -7,11 +7,8 @@ namespace Lumina.Domain.Common.Primitives;
|
||||
/// <typeparam name="TValue">The type of the value represented by this structure.</typeparam>
|
||||
public readonly struct Optional<TValue>
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly TValue? _value;
|
||||
#endregion
|
||||
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this structure has a value.
|
||||
/// </summary>
|
||||
@@ -21,9 +18,7 @@ public readonly struct Optional<TValue>
|
||||
/// Gets the value represented by this structure.
|
||||
/// </summary>
|
||||
public TValue Value => HasValue ? _value! : default!;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Optional{TValue}"/> structure.
|
||||
/// </summary>
|
||||
@@ -34,9 +29,7 @@ public readonly struct Optional<TValue>
|
||||
_value = value;
|
||||
HasValue = hasValue;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Custom implementation operator for converting <paramref name="value"/> to an <see cref="Optional{TValue}"/>.
|
||||
/// </summary>
|
||||
@@ -94,5 +87,4 @@ public readonly struct Optional<TValue>
|
||||
{
|
||||
return HasValue ? Value?.ToString()! : string.Empty;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -14,12 +14,9 @@ namespace Lumina.Domain.Common.ValueObjects.Metadata;
|
||||
[DebuggerDisplay("{Title}")]
|
||||
public abstract class BaseMetadata : ValueObject
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly List<Tag> _tags;
|
||||
private readonly List<Genre> _genres;
|
||||
#endregion
|
||||
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the title of the media item.
|
||||
/// </summary>
|
||||
@@ -59,9 +56,7 @@ public abstract class BaseMetadata : ValueObject
|
||||
/// Gets the list of genres associated with the media item.
|
||||
/// </summary>
|
||||
public IReadOnlyCollection<Genre> Genres => _genres.AsReadOnly();
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BaseMetadata"/> class.
|
||||
/// </summary>
|
||||
@@ -93,9 +88,7 @@ public abstract class BaseMetadata : ValueObject
|
||||
Language = language;
|
||||
OriginalLanguage = originalLanguage;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <inheritdoc/>
|
||||
public override IEnumerable<object> GetEqualityComponents()
|
||||
{
|
||||
@@ -110,5 +103,4 @@ public abstract class BaseMetadata : ValueObject
|
||||
yield return Language;
|
||||
yield return OriginalLanguage;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -13,14 +13,11 @@ namespace Lumina.Domain.Common.ValueObjects.Metadata;
|
||||
[DebuggerDisplay("{Name}")]
|
||||
public class Genre : ValueObject
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the name of the genre element of the media item.
|
||||
/// </summary>
|
||||
public string Name { get; }
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Genre"/> class.
|
||||
/// </summary>
|
||||
@@ -29,9 +26,7 @@ public class Genre : ValueObject
|
||||
{
|
||||
Name = name.Trim();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="Genre"/> class.
|
||||
/// </summary>
|
||||
@@ -60,5 +55,4 @@ public class Genre : ValueObject
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -14,7 +14,6 @@ namespace Lumina.Domain.Common.ValueObjects.Metadata;
|
||||
[DebuggerDisplay("{LanguageCode}")]
|
||||
public class LanguageInfo : ValueObject
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the ISO 639-1 two-letter language code.
|
||||
/// </summary>
|
||||
@@ -29,9 +28,7 @@ public class LanguageInfo : ValueObject
|
||||
/// Gets an optional native name of the language.
|
||||
/// </summary>
|
||||
public Optional<string> NativeName { get; private set; }
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LanguageInfo"/> class.
|
||||
/// </summary>
|
||||
@@ -44,9 +41,7 @@ public class LanguageInfo : ValueObject
|
||||
LanguageName = languageName;
|
||||
NativeName = nativeName;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="LanguageInfo"/> class.
|
||||
/// </summary>
|
||||
@@ -83,5 +78,4 @@ public class LanguageInfo : ValueObject
|
||||
{
|
||||
return $"{LanguageCode} - {LanguageName}";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -12,7 +12,6 @@ namespace Lumina.Domain.Common.ValueObjects.Metadata;
|
||||
[DebuggerDisplay("{Value}/{MaxValue}")]
|
||||
public abstract class Rating : ValueObject
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the numeric value of the rating.
|
||||
/// </summary>
|
||||
@@ -27,9 +26,7 @@ public abstract class Rating : ValueObject
|
||||
/// Gets the optional number of votes or reviews this rating is based on.
|
||||
/// </summary>
|
||||
public Optional<int> VoteCount { get; private set; }
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Rating"/> class.
|
||||
/// </summary>
|
||||
@@ -42,9 +39,7 @@ public abstract class Rating : ValueObject
|
||||
MaxValue = maxValue;
|
||||
VoteCount = voteCount;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Returns the rating as a percentage.
|
||||
/// </summary>
|
||||
@@ -53,5 +48,4 @@ public abstract class Rating : ValueObject
|
||||
{
|
||||
return Value / MaxValue * 100;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -15,7 +15,6 @@ namespace Lumina.Domain.Common.ValueObjects.Metadata;
|
||||
[DebuggerDisplay("{ReleaseYear}")]
|
||||
public class ReleaseInfo : ValueObject
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the optional original release date of the media item.
|
||||
/// </summary>
|
||||
@@ -46,9 +45,7 @@ public class ReleaseInfo : ValueObject
|
||||
/// Gets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0")
|
||||
/// </summary>
|
||||
public Optional<string> ReleaseVersion { get; }
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ReleaseInfo"/> class.
|
||||
/// </summary>
|
||||
@@ -73,9 +70,7 @@ public class ReleaseInfo : ValueObject
|
||||
ReleaseCountry = releaseCountry;
|
||||
ReleaseVersion = releaseVersion;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="ReleaseInfo"/> class.
|
||||
/// </summary>
|
||||
@@ -117,5 +112,4 @@ public class ReleaseInfo : ValueObject
|
||||
yield return ReleaseCountry;
|
||||
yield return ReleaseVersion;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -13,14 +13,11 @@ namespace Lumina.Domain.Common.ValueObjects.Metadata;
|
||||
[DebuggerDisplay("{Name}")]
|
||||
public class Tag : ValueObject
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the name of the tag element of the media item.
|
||||
/// </summary>
|
||||
public string Name { get; }
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Tag"/> class.
|
||||
/// </summary>
|
||||
@@ -29,9 +26,7 @@ public class Tag : ValueObject
|
||||
{
|
||||
Name = name.Trim();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="Tag"/> class.
|
||||
/// </summary>
|
||||
@@ -60,5 +55,4 @@ public class Tag : ValueObject
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
-6
@@ -14,7 +14,6 @@ namespace Lumina.Domain.Core.Aggregates.AudioLibrary.AudioLibraryAggregate.Value
|
||||
[DebuggerDisplay("{Title}")]
|
||||
public class AudioMetadata : BaseMetadata
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the duration of the video in seconds.
|
||||
/// </summary>
|
||||
@@ -44,9 +43,7 @@ public class AudioMetadata : BaseMetadata
|
||||
/// Gets the bitrate of the audio in kbps.
|
||||
/// </summary>
|
||||
public Optional<int> Bitrate { get; }
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AudioMetadata"/> class.
|
||||
/// </summary>
|
||||
@@ -87,9 +84,7 @@ public class AudioMetadata : BaseMetadata
|
||||
AudioCodec = audioCodec;
|
||||
Bitrate = bitrate;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="AudioMetadata"/> class.
|
||||
/// </summary>
|
||||
@@ -155,5 +150,4 @@ public class AudioMetadata : BaseMetadata
|
||||
yield return AudioCodec;
|
||||
yield return Bitrate;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
-8
@@ -16,11 +16,8 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.E
|
||||
[DebuggerDisplay("{Id.Path}")]
|
||||
public sealed class Directory : FileSystemItem
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly List<FileSystemItem> _items = [];
|
||||
#endregion
|
||||
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets or sets the creation date of the file system item. Can be optional if the information is not available.
|
||||
/// </summary>
|
||||
@@ -35,9 +32,7 @@ public sealed class Directory : FileSystemItem
|
||||
/// Gets the collection of file system items that are children to the current directory entity.
|
||||
/// </summary>
|
||||
public IReadOnlyCollection<FileSystemItem> Items => _items.AsReadOnly();
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Directory"/> class.
|
||||
/// </summary>
|
||||
@@ -50,9 +45,7 @@ public sealed class Directory : FileSystemItem
|
||||
DateCreated = dateCreated;
|
||||
DateModified = dateModified;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="Directory"/> class.
|
||||
/// </summary>
|
||||
@@ -146,5 +139,4 @@ public sealed class Directory : FileSystemItem
|
||||
_items.Remove(item);
|
||||
return Result.Updated;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
-6
@@ -16,7 +16,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.E
|
||||
[DebuggerDisplay("{Id.Path}")]
|
||||
public sealed class File : FileSystemItem
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets or sets the creation date of the file system item. Can be optional if the information is not available.
|
||||
/// </summary>
|
||||
@@ -31,9 +30,7 @@ public sealed class File : FileSystemItem
|
||||
/// Gets or sets the size in bytes of the current file entity.
|
||||
/// </summary>
|
||||
public long Size { get; private set; }
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="File"/> class.
|
||||
/// </summary>
|
||||
@@ -48,9 +45,7 @@ public sealed class File : FileSystemItem
|
||||
DateModified = dateModified;
|
||||
Size = size;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="File"/> class.
|
||||
/// </summary>
|
||||
@@ -153,5 +148,4 @@ public sealed class File : FileSystemItem
|
||||
Name = newName;
|
||||
return Result.Updated;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
-8
@@ -14,19 +14,14 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.E
|
||||
[DebuggerDisplay("{Id.Path}")]
|
||||
public sealed class UnixRootItem : FileSystemItem
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly List<FileSystemItem> _items = [];
|
||||
private const string PATH = "/";
|
||||
#endregion
|
||||
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the collection of file system items that are children to the current file system root entity.
|
||||
/// </summary>
|
||||
public IReadOnlyCollection<FileSystemItem> Items => _items.AsReadOnly();
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UnixRootItem"/> class.
|
||||
/// </summary>
|
||||
@@ -35,9 +30,7 @@ public sealed class UnixRootItem : FileSystemItem
|
||||
private UnixRootItem(FileSystemPathId id, string name) : base(id, name, FileSystemItemType.Root)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="UnixRootItem"/> class.
|
||||
/// </summary>
|
||||
@@ -59,5 +52,4 @@ public sealed class UnixRootItem : FileSystemItem
|
||||
return setStatusResult.Errors;
|
||||
return newRoot;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
-8
@@ -14,18 +14,13 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.E
|
||||
[DebuggerDisplay("{Id.Path}")]
|
||||
public sealed class WindowsRootItem : FileSystemItem
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly List<FileSystemItem> _items = [];
|
||||
#endregion
|
||||
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the collection of file system items that are children to the current file system root entity.
|
||||
/// </summary>
|
||||
public IReadOnlyCollection<FileSystemItem> Items => _items.AsReadOnly();
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="WindowsRootItem"/> class.
|
||||
/// </summary>
|
||||
@@ -34,9 +29,7 @@ public sealed class WindowsRootItem : FileSystemItem
|
||||
private WindowsRootItem(FileSystemPathId id, string name) : base(id, name, FileSystemItemType.Root)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="WindowsRootItem"/> class.
|
||||
/// </summary>
|
||||
@@ -87,5 +80,4 @@ public sealed class WindowsRootItem : FileSystemItem
|
||||
return setStatusResult.Errors;
|
||||
return newFile;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
-6
@@ -16,7 +16,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate;
|
||||
[DebuggerDisplay("{Name}")]
|
||||
public abstract class FileSystemItem : AggregateRoot<FileSystemPathId>
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the file system item.
|
||||
/// </summary>
|
||||
@@ -36,9 +35,7 @@ public abstract class FileSystemItem : AggregateRoot<FileSystemPathId>
|
||||
/// Gets or sets the tpe of the file system item.
|
||||
/// </summary>
|
||||
public FileSystemItemType Type { get; protected set; }
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FileSystemItem"/> class.
|
||||
/// </summary>
|
||||
@@ -50,9 +47,7 @@ public abstract class FileSystemItem : AggregateRoot<FileSystemPathId>
|
||||
Name = name;
|
||||
Type = fileSystemItemType;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Sets the status of the filesystem item.
|
||||
/// </summary>
|
||||
@@ -77,5 +72,4 @@ public abstract class FileSystemItem : AggregateRoot<FileSystemPathId>
|
||||
return Errors.FileManagement.ParentNodeCannotBeNull;
|
||||
return Result.Updated;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
-6
@@ -18,12 +18,9 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
|
||||
/// </summary>
|
||||
internal class DirectoryProviderService : IDirectoryProviderService
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly IFileSystemPermissionsService _fileSystemPermissionsService;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DirectoryProviderService"/> class.
|
||||
/// </summary>
|
||||
@@ -34,9 +31,7 @@ internal class DirectoryProviderService : IDirectoryProviderService
|
||||
_fileSystem = fileSystem;
|
||||
_fileSystemPermissionsService = fileSystemPermissionsService;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Retrieves a list of subdirectory paths from the specified path.
|
||||
/// </summary>
|
||||
@@ -322,5 +317,4 @@ internal class DirectoryProviderService : IDirectoryProviderService
|
||||
_fileSystem.DirectoryInfo.New(path.Path).Delete(true);
|
||||
return Result.Deleted;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
-6
@@ -18,12 +18,9 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
|
||||
/// </summary>
|
||||
public class DirectoryService : IDirectoryService
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly IPlatformContext _platformContext;
|
||||
private readonly IEnvironmentContext _environmentContext;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DirectoryService"/> class.
|
||||
/// </summary>
|
||||
@@ -34,9 +31,7 @@ public class DirectoryService : IDirectoryService
|
||||
_platformContext = platformContextManager.GetCurrentContext();
|
||||
_environmentContext = environmentContext;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Retrieves subdirectories for the specified string path.
|
||||
/// </summary>
|
||||
@@ -336,5 +331,4 @@ public class DirectoryService : IDirectoryService
|
||||
{
|
||||
return _environmentContext.DirectoryProviderService.DeleteDirectory(path);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
-6
@@ -15,12 +15,9 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
|
||||
/// </summary>
|
||||
public class DriveService : IDriveService
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly IPlatformContext _platformContext;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DriveService"/> class.
|
||||
/// </summary>
|
||||
@@ -30,9 +27,7 @@ public class DriveService : IDriveService
|
||||
_fileSystem = fileSystem;
|
||||
_platformContext = platformContextManager.GetCurrentContext();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Retrieves the list of drives.
|
||||
/// </summary>
|
||||
@@ -64,5 +59,4 @@ public class DriveService : IDriveService
|
||||
.Select(errorOrDrive => errorOrDrive.Value)
|
||||
.AsEnumerable());
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
-6
@@ -18,12 +18,9 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
|
||||
/// </summary>
|
||||
internal class FileProviderService : IFileProviderService
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly IFileSystemPermissionsService _fileSystemPermissionsService;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FileProviderService"/> class.
|
||||
/// </summary>
|
||||
@@ -34,9 +31,7 @@ internal class FileProviderService : IFileProviderService
|
||||
_fileSystem = fileSystem;
|
||||
_fileSystemPermissionsService = fileSystemPermissionsService;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Retrieves a list of file paths at the specified path.
|
||||
/// </summary>
|
||||
@@ -284,5 +279,4 @@ internal class FileProviderService : IFileProviderService
|
||||
_fileSystem.File.Delete(path.Path);
|
||||
return Result.Deleted;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
-6
@@ -18,12 +18,9 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
|
||||
/// </summary>
|
||||
public class FileService : IFileService
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly IPlatformContext _platformContext;
|
||||
private readonly IEnvironmentContext _environmentContext;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FileService"/> class.
|
||||
/// </summary>
|
||||
@@ -34,9 +31,7 @@ public class FileService : IFileService
|
||||
_platformContext = platformContextManager.GetCurrentContext();
|
||||
_environmentContext = environmentContext;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Retrieves files for the specified string path.
|
||||
/// </summary>
|
||||
@@ -327,5 +322,4 @@ public class FileService : IFileService
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
-6
@@ -18,11 +18,8 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
|
||||
/// </summary>
|
||||
internal class FileSystemPermissionsService : IFileSystemPermissionsService // TODO: refactor towards abstractions that could allow testing
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly IPlatformContextManager _platformContextManager;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FileSystemPermissionsService"/> class.
|
||||
/// </summary>
|
||||
@@ -31,9 +28,7 @@ internal class FileSystemPermissionsService : IFileSystemPermissionsService // T
|
||||
{
|
||||
_platformContextManager = platformContextManager;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Checks if <paramref name="path"/> can be accessed.
|
||||
/// </summary>
|
||||
@@ -209,5 +204,4 @@ internal class FileSystemPermissionsService : IFileSystemPermissionsService // T
|
||||
}
|
||||
return allowAccess;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
-6
@@ -20,13 +20,10 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
|
||||
/// </summary>
|
||||
public class FileTypeService : IFileTypeService
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly IFileSystemPermissionsService _fileSystemPermissionsService;
|
||||
private const int BUFFER_SIZE = 18; // 18 bytes should be more than enough for common images header types
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FileTypeService"/> class.
|
||||
/// </summary>
|
||||
@@ -37,9 +34,7 @@ public class FileTypeService : IFileTypeService
|
||||
_fileSystem = fileSystem;
|
||||
_fileSystemPermissionsService = fileSystemPermissionsService;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Determines if <paramref name="file"/> is of type image or not, and returns its type.
|
||||
/// </summary>
|
||||
@@ -159,5 +154,4 @@ public class FileTypeService : IFileTypeService
|
||||
return ImageType.WEBP; // WEBP
|
||||
return ImageType.None;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
-2
@@ -13,7 +13,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
|
||||
/// </summary>
|
||||
public interface IDirectoryProviderService
|
||||
{
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Retrieves a list of subdirectory paths from the specified path.
|
||||
/// </summary>
|
||||
@@ -91,5 +90,4 @@ public interface IDirectoryProviderService
|
||||
/// <param name="path">The path of the directory to be deleted.</param>
|
||||
/// <returns>An <see cref="ErrorOr{TValue}"/> containing either the result of deleting a directory, or an error.</returns>
|
||||
ErrorOr<Deleted> DeleteDirectory(FileSystemPathId path);
|
||||
#endregion
|
||||
}
|
||||
-2
@@ -12,7 +12,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
|
||||
/// </summary>
|
||||
public interface IDirectoryService
|
||||
{
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Retrieves subdirectories for the specified string path.
|
||||
/// </summary>
|
||||
@@ -77,5 +76,4 @@ public interface IDirectoryService
|
||||
/// <param name="path">String representation of the directory path.</param>
|
||||
/// <returns>An <see cref="ErrorOr{TValue}"/> containing either the result of deleting a directory, or an error.</returns>
|
||||
ErrorOr<Deleted> DeleteDirectory(string path);
|
||||
#endregion
|
||||
}
|
||||
-2
@@ -10,11 +10,9 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
|
||||
/// </summary>
|
||||
public interface IDriveService
|
||||
{
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Retrieves the list of drives.
|
||||
/// </summary>
|
||||
/// <returns>An <see cref="ErrorOr{TValue}"/> containing either a collection of drives or an error.</returns>
|
||||
ErrorOr<IEnumerable<FileSystemItem>> GetDrives();
|
||||
#endregion
|
||||
}
|
||||
-2
@@ -13,7 +13,6 @@ namespace Lumina.Domain.Core.Aggregates.FileManagement.FileManagementAggregate.S
|
||||
/// </summary>
|
||||
public interface IFileProviderService
|
||||
{
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Retrieves a list of files at the specified path.
|
||||
/// </summary>
|
||||
@@ -96,5 +95,4 @@ public interface IFileProviderService
|
||||
/// <param name="path">The path of the file to be deleted.</param>
|
||||
/// <returns>An <see cref="ErrorOr{TValue}"/> containing either the result of deleting a file, or an error.</returns>
|
||||
ErrorOr<Deleted> DeleteFile(FileSystemPathId path);
|
||||
#endregion
|
||||
}
|
||||
Loaded 100 of 370 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user