eliminates region sections

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

No files matched your search

@@ -13,11 +13,8 @@ namespace Lumina.Presentation.Api.Common.Configuration;
/// </summary>
public class ConfigureSwaggerOptions : IConfigureNamedOptions<SwaggerGenOptions>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IApiVersionDescriptionProvider _provider;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="ConfigureSwaggerOptions"/> class.
/// </summary>
@@ -26,9 +23,7 @@ public class ConfigureSwaggerOptions : IConfigureNamedOptions<SwaggerGenOptions>
{
_provider = provider;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Configures the Swagger options.
/// </summary>
@@ -66,5 +61,4 @@ public class ConfigureSwaggerOptions : IConfigureNamedOptions<SwaggerGenOptions>
info.Description += " This API version has been deprecated.";
return info;
}
#endregion
}
@@ -12,7 +12,6 @@ namespace Lumina.Presentation.Api.Common.DependencyInjection;
/// </summary>
internal static class PresentationApiLayerConfiguration
{
#region ================================================================== METHODS ===================================================================================
/// <summary>
/// Extension method for adding the Presentation API layer configuration to the DI container.
/// </summary>
@@ -31,5 +30,4 @@ internal static class PresentationApiLayerConfiguration
return services;
}
#endregion
}
@@ -17,7 +17,6 @@ namespace Lumina.Presentation.Api.Common.DependencyInjection;
/// </summary>
public static class PresentationApiLayerServices
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Registers the services of the Presentation API layer into the dependency injection container.
/// </summary>
@@ -71,5 +70,4 @@ public static class PresentationApiLayerServices
return services;
}
#endregion
}
@@ -19,12 +19,9 @@ namespace Lumina.Presentation.Api.Common.Errors;
/// </summary>
public class CustomProblemDetailsFactory : ProblemDetailsFactory
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly ApiBehaviorOptions _options;
private readonly Action<ProblemDetailsContext>? _configure;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="CustomProblemDetailsFactory"/> class.
/// </summary>
@@ -36,9 +33,7 @@ public class CustomProblemDetailsFactory : ProblemDetailsFactory
_options = apiBehaviorOptions?.Value ?? throw new ArgumentNullException(nameof(apiBehaviorOptions));
_configure = problemDetailsOptions?.Value?.CustomizeProblemDetails;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a <see cref="ProblemDetails"/> instance that configures defaults based on values specified in <see cref="ApiBehaviorOptions"/>.
/// </summary>
@@ -120,5 +115,4 @@ public class CustomProblemDetailsFactory : ProblemDetailsFactory
//problemDetails.Extensions.Add("errorCodes", errors.Select(e => e.Type.ToString()));
_configure?.Invoke(new() { HttpContext = httpContext!, ProblemDetails = problemDetails });
}
#endregion
}
@@ -7,7 +7,5 @@ namespace Lumina.Presentation.Api.Common.Http;
/// </summary>
public static class HttpContextItemKeys
{
#region ================================================================== FIELD MEMBERS ================================================================================
public const string ERRORS = "errors";
#endregion
}
@@ -11,7 +11,6 @@ namespace Lumina.Presentation.Api.Common.Mapping.WrittenContentLibrary.BookLibra
/// </summary>
public class BookMappingConfig : IRegister
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Registers the mapping configuration.
/// </summary>
@@ -25,5 +24,4 @@ public class BookMappingConfig : IRegister
.Map(dest => dest.OCLCNumber, src => src.OCLCNumber)
.MapToConstructor(true);
}
#endregion
}
@@ -11,7 +11,6 @@ namespace Lumina.Presentation.Api.Common.ModelBinders;
/// </summary>
public class UrlStringBinder : IModelBinder
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Binds a model to a value by using the specified controller context and binding context.
/// </summary>
@@ -36,5 +35,4 @@ public class UrlStringBinder : IModelBinder
bindingContext.Result = ModelBindingResult.Success(value);
return Task.CompletedTask;
}
#endregion
}
@@ -11,7 +11,6 @@ namespace Lumina.Presentation.Api.Common.Utilities;
/// </summary>
public static class MimeTypes
{
#region ================================================================== FIELD MEMBERS ================================================================================
private static readonly FrozenDictionary<ImageType, string> s_imageTypeToMimeType = new Dictionary<ImageType, string>
{
{ ImageType.BMP, "image/bmp" },
@@ -30,9 +29,7 @@ public static class MimeTypes
{ ImageType.TGA, "image/x-tga" },
{ ImageType.SVG, "image/svg+xml" }
}.ToFrozenDictionary();
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the mime type of <paramref name="type"/>.
/// </summary>
@@ -42,5 +39,4 @@ public static class MimeTypes
{
return s_imageTypeToMimeType.TryGetValue(type, out string? mimeType) ? mimeType : "application/octet-stream";
}
#endregion
}
@@ -17,7 +17,6 @@ namespace Lumina.Presentation.Api.Core.Controllers.Common;
[ApiVersion("1.0")]
public abstract class ApiController : ControllerBase
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Handles controllers errors.
/// </summary>
@@ -67,5 +66,4 @@ public abstract class ApiController : ControllerBase
modelStateDictionary.AddModelError(error.Code, error.Description);
return ValidationProblem(modelStateDictionary: modelStateDictionary, title: "One or more validation errors occurred.");
}
#endregion
}
@@ -22,11 +22,8 @@ namespace Lumina.Presentation.Api.Core.Controllers.FileManagement;
[Route("api/v{version:apiVersion}/[controller]")]
public class DirectoriesController : ApiController
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly ISender _mediator;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="DirectoriesController"/> class.
/// </summary>
@@ -35,9 +32,7 @@ public class DirectoriesController : ApiController
{
_mediator = mediator;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the tree of expanded directories leading up to <paramref name="path"/>, with the additional list of drives, and children of the last child directory.
/// </summary>
@@ -103,5 +98,4 @@ public class DirectoriesController : ApiController
}
}
}
#endregion
}
@@ -19,11 +19,8 @@ namespace Lumina.Presentation.Api.Core.Controllers.FileManagement;
[Route("api/v{version:apiVersion}/[controller]")]
public class DrivesController : ApiController
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly ISender _mediator;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="DrivesController"/> class.
/// </summary>
@@ -32,9 +29,7 @@ public class DrivesController : ApiController
{
_mediator = mediator;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Controller action for getting the list of all file system drives.
/// </summary>
@@ -45,5 +40,4 @@ public class DrivesController : ApiController
ErrorOr<IEnumerable<FileSystemTreeNodeResponse>> result = await _mediator.Send(new GetDrivesQuery(), cancellationToken).ConfigureAwait(false);
return result.Match(result => Ok(result), errors => Problem(errors));
}
#endregion
}
@@ -17,11 +17,8 @@ namespace Lumina.Presentation.Api.Core.Controllers.FileManagement;
[Route("api/v{version:apiVersion}/file-system")]
public class FileSystemController : ApiController
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly ISender _mediator;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="FileSystemController"/> class.
/// </summary>
@@ -30,9 +27,7 @@ public class FileSystemController : ApiController
{
_mediator = mediator;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the type of the file system.
/// </summary>
@@ -43,5 +38,4 @@ public class FileSystemController : ApiController
FileSystemTypeResponse platformType = await _mediator.Send(new GetFileSystemQuery(), cancellationToken).ConfigureAwait(false);
return Ok(platformType);
}
#endregion
}
@@ -21,11 +21,8 @@ namespace Lumina.Presentation.Api.Core.Controllers.FileManagement;
[Route("api/v{version:apiVersion}/[controller]")]
public class FilesController : ApiController
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly ISender _mediator;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="FilesController"/> class.
/// </summary>
@@ -34,9 +31,7 @@ public class FilesController : ApiController
{
_mediator = mediator;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the files of <paramref name="path"/>.
/// </summary>
@@ -80,5 +75,4 @@ public class FilesController : ApiController
}
}
}
#endregion
}
@@ -26,11 +26,8 @@ namespace Lumina.Presentation.Api.Core.Controllers.FileManagement;
[Route("api/v{version:apiVersion}/[controller]")]
public class PathController : ApiController
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly ISender _mediator;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="PathController"/> class.
/// </summary>
@@ -39,9 +36,7 @@ public class PathController : ApiController
{
_mediator = mediator;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the root of <paramref name="path"/>.
/// </summary>
@@ -126,5 +121,4 @@ public class PathController : ApiController
PathExistsResponse result = await _mediator.Send(new CheckPathExistsQuery(path, includeHiddenElements), cancellationToken).ConfigureAwait(false);
return Ok(result);
}
#endregion
}
@@ -20,11 +20,8 @@ namespace Lumina.Presentation.Api.Core.Controllers.FileManagement;
[Route("api/v{version:apiVersion}/[controller]")]
public class ThumbnailsController : ApiController
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly ISender _mediator;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="ThumbnailsController"/> class.
/// </summary>
@@ -33,9 +30,7 @@ public class ThumbnailsController : ApiController
{
_mediator = mediator;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the thumbnail of a file identified by of <paramref name="path"/>.
/// </summary>
@@ -48,5 +43,4 @@ public class ThumbnailsController : ApiController
ErrorOr<ThumbnailResponse> getResult = await _mediator.Send(new GetThumbnailQuery(path, quality), cancellationToken);
return getResult.Match(result => File(result.Bytes, MimeTypes.GetMimeType(result.Type)), errors => Problem(errors));
}
#endregion
}
@@ -12,7 +12,6 @@ namespace Lumina.Presentation.Api.Core.Controllers.Maintenance;
[Route("[controller]")]
public class HealthController : ApiController
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Checks if the application is healthy.
/// </summary>
@@ -22,5 +21,4 @@ public class HealthController : ApiController
// TODO: to be implemented
return await Task.FromResult(Ok());
}
#endregion
}
@@ -18,12 +18,9 @@ namespace Lumina.Presentation.Api.Core.Controllers.WrittenContentLibrary.BookLib
[Route("api/v{version:apiVersion}/[controller]")]
public class BooksController : ApiController
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly ISender _mediator;
private readonly IMapper _mapper;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="BooksController"/> class.
/// </summary>
@@ -34,9 +31,7 @@ public class BooksController : ApiController
_mediator = mediator;
_mapper = mapper;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Controller action for getting the list of all books.
/// </summary>
@@ -57,5 +52,4 @@ public class BooksController : ApiController
ErrorOr.ErrorOr<Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggregate.Book> result = await _mediator.Send(_mapper.Map<AddBookCommand>(request)).ConfigureAwait(false);
return result.Match(result => Created($"/api/v1/books/{result.Id}", result), Problem);
}
#endregion
}
-2
View File
@@ -16,7 +16,6 @@ namespace Lumina.Presentation.Api;
/// </summary>
public class Program
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Application entry point.
/// </summary>
@@ -53,5 +52,4 @@ public class Program
await app.RunAsync().ConfigureAwait(false);
}
#endregion
}