diff --git a/src/BUTR.Site.NexusMods.Server/Models/API/MessageResponse.cs b/src/BUTR.Site.NexusMods.Server/Models/API/MessageResponse.cs index c4ed67c5..03a6f3dd 100644 --- a/src/BUTR.Site.NexusMods.Server/Models/API/MessageResponse.cs +++ b/src/BUTR.Site.NexusMods.Server/Models/API/MessageResponse.cs @@ -1,4 +1,3 @@ using Microsoft.AspNetCore.Mvc; -namespace BUTR.Site.NexusMods.Server.Models.API; - +namespace BUTR.Site.NexusMods.Server.Models.API; \ No newline at end of file diff --git a/src/BUTR.Site.NexusMods.Server/Startup.cs b/src/BUTR.Site.NexusMods.Server/Startup.cs index 8640c07d..c138a350 100644 --- a/src/BUTR.Site.NexusMods.Server/Startup.cs +++ b/src/BUTR.Site.NexusMods.Server/Startup.cs @@ -156,7 +156,7 @@ public void ConfigureServices(IServiceCollection services) client.BaseAddress = new Uri("https://embed.gog.com/"); client.DefaultRequestHeaders.Add("User-Agent", userAgent); }).AddPolicyHandler(GetRetryPolicy()); - + services.AddSingleton(); services.AddSingleton(); @@ -240,7 +240,7 @@ public void ConfigureServices(IServiceCollection services) services.AddControllersWithAPIResult(opt => opt.ValueProviderFactories.Add(new ClaimsValueProviderFactory())) .AddJsonOptions(opt => Configure(opt.JsonSerializerOptions)); - + services.AddHttpContextAccessor(); services.AddRouting(); services.AddResponseCompression(options => diff --git a/src/BUTR.Site.NexusMods.Server/Utils/Http/ApiResults/ApiResult.cs b/src/BUTR.Site.NexusMods.Server/Utils/Http/ApiResults/ApiResult.cs index f98bcac7..80294e2d 100644 --- a/src/BUTR.Site.NexusMods.Server/Utils/Http/ApiResults/ApiResult.cs +++ b/src/BUTR.Site.NexusMods.Server/Utils/Http/ApiResults/ApiResult.cs @@ -6,9 +6,9 @@ namespace BUTR.Site.NexusMods.Server.Utils.Http.ApiResults; public record ApiResult(ProblemDetails? Error) : IApiResult, IConvertToActionResult { public static implicit operator ObjectResult(ApiResult apiResult) => new(apiResult); - + public static ApiResult FromError(ProblemDetails? error) => new(error); - + public IActionResult Convert() => (ObjectResult) this; } @@ -22,6 +22,6 @@ public sealed record ApiResult(TValue? Value, ProblemDetails? Error) : I public static ApiResult FromResult(TValue? data, ProblemDetails? error = null) => new(data, error); public static ApiResult FromError(ProblemDetails? error) => new(default, error); - + public IActionResult Convert() => (ObjectResult) this; } \ No newline at end of file diff --git a/src/BUTR.Site.NexusMods.Server/Utils/Http/ApiResults/ApiResultOperationFilter.cs b/src/BUTR.Site.NexusMods.Server/Utils/Http/ApiResults/ApiResultOperationFilter.cs index cd2f85d4..b578a479 100644 --- a/src/BUTR.Site.NexusMods.Server/Utils/Http/ApiResults/ApiResultOperationFilter.cs +++ b/src/BUTR.Site.NexusMods.Server/Utils/Http/ApiResults/ApiResultOperationFilter.cs @@ -16,7 +16,7 @@ public void Apply(OpenApiOperation operation, OperationFilterContext? context) if (!operation.Responses.TryGetValue("200", out var successResponse)) return; - + var copy400 = CopyHelper.CopyPublicProperties(successResponse, new OpenApiResponse()); copy400.Description = "Invalid API Request."; operation.Responses.Add("400", copy400); diff --git a/src/BUTR.Site.NexusMods.Server/Utils/Http/ApiResults/IMvcBuilderExtensions.cs b/src/BUTR.Site.NexusMods.Server/Utils/Http/ApiResults/IMvcBuilderExtensions.cs index d850c981..6aa9e38a 100644 --- a/src/BUTR.Site.NexusMods.Server/Utils/Http/ApiResults/IMvcBuilderExtensions.cs +++ b/src/BUTR.Site.NexusMods.Server/Utils/Http/ApiResults/IMvcBuilderExtensions.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.Extensions.DependencyInjection; diff --git a/src/BUTR.Site.NexusMods.Server/Utils/Http/ApiResults/IServiceCollectionExtensions.cs b/src/BUTR.Site.NexusMods.Server/Utils/Http/ApiResults/IServiceCollectionExtensions.cs index 6624be4b..d1ce6cbd 100644 --- a/src/BUTR.Site.NexusMods.Server/Utils/Http/ApiResults/IServiceCollectionExtensions.cs +++ b/src/BUTR.Site.NexusMods.Server/Utils/Http/ApiResults/IServiceCollectionExtensions.cs @@ -1,4 +1,4 @@ -using BUTR.Site.NexusMods.Server.Extensions; +using BUTR.Site.NexusMods.Server.Extensions; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; diff --git a/src/BUTR.Site.NexusMods.Server/Utils/Http/StreamingMultipartResults/StreamingMultipartResult.cs b/src/BUTR.Site.NexusMods.Server/Utils/Http/StreamingMultipartResults/StreamingMultipartResult.cs index 35e5bd18..a56fd362 100644 --- a/src/BUTR.Site.NexusMods.Server/Utils/Http/StreamingMultipartResults/StreamingMultipartResult.cs +++ b/src/BUTR.Site.NexusMods.Server/Utils/Http/StreamingMultipartResults/StreamingMultipartResult.cs @@ -14,7 +14,7 @@ public sealed class StreamingMultipartResult : IActionResult { public IEnumerable> Contents { get; } public string Mime { get; } - + public StreamingMultipartResult(IEnumerable> contents, string mime) { Contents = contents;