diff --git a/Api/Api.csproj b/Api/Api.csproj index c425447..4cf61e9 100644 --- a/Api/Api.csproj +++ b/Api/Api.csproj @@ -1,17 +1,12 @@  - - net9.0 - enable - enable - - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Api/Configurations/SwaggerExtension.cs b/Api/Configurations/SwaggerExtension.cs index 8901bcf..a8b668b 100644 --- a/Api/Configurations/SwaggerExtension.cs +++ b/Api/Configurations/SwaggerExtension.cs @@ -1,6 +1,6 @@ using Api.Helpers; using Microsoft.AspNetCore.Authentication.JwtBearer; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; namespace Api.Configurations; @@ -30,34 +30,19 @@ public static class SwaggerExtension }); // Configures Bearer token authentication for Swagger - options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme + options.AddSecurityDefinition(JwtBearerDefaults.AuthenticationScheme, new OpenApiSecurityScheme { - Description = @"JWT Authorization header using the Bearer scheme. - Enter 'Bearer' [space] and then your token in the text input below. - Example: 'Bearer 12345abcdef'", + Description = "JWT Authorization header using the Bearer scheme.", Name = "Authorization", + BearerFormat = "JWT", In = ParameterLocation.Header, - Type = SecuritySchemeType.ApiKey, + Type = SecuritySchemeType.Http, Scheme = JwtBearerDefaults.AuthenticationScheme }); - // Adds security requirements for Bearer token authentication - options.AddSecurityRequirement(new OpenApiSecurityRequirement + options.AddSecurityRequirement(document => new OpenApiSecurityRequirement { - { - new OpenApiSecurityScheme - { - Reference = new OpenApiReference - { - Type = ReferenceType.SecurityScheme, - Id = JwtBearerDefaults.AuthenticationScheme - }, - Scheme = "Oauth2", - Name = JwtBearerDefaults.AuthenticationScheme, - In = ParameterLocation.Header - }, - new List() - } + [new OpenApiSecuritySchemeReference(JwtBearerDefaults.AuthenticationScheme, document)] = [] }); }); } diff --git a/Api/Helpers/HideEndpointsInProductionFilter.cs b/Api/Helpers/HideEndpointsInProductionFilter.cs index 1328729..130c92a 100644 --- a/Api/Helpers/HideEndpointsInProductionFilter.cs +++ b/Api/Helpers/HideEndpointsInProductionFilter.cs @@ -1,4 +1,4 @@ -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using Swashbuckle.AspNetCore.SwaggerGen; namespace Api.Helpers; diff --git a/Api/Program.cs b/Api/Program.cs index 30b1f99..0d62c68 100644 --- a/Api/Program.cs +++ b/Api/Program.cs @@ -3,6 +3,7 @@ using Api.Middleware; using Application; using Database; using HealthChecks.UI.Client; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Serilog; using Utilities.Classes; @@ -24,7 +25,6 @@ try .WriteTo.File(logPath, rollingInterval: RollingInterval.Day, rollOnFileSizeLimit: true); }); - builder.Services.AddDatabase(builder.Configuration); builder.Services.AddApplication(); @@ -54,6 +54,8 @@ try app.UseStaticFiles(); app.UseDefaultFiles(); + app.MapOpenApi(); + app.UseSwagger(); app.UseSwaggerUI(); diff --git a/Application/Application.csproj b/Application/Application.csproj index a5024ce..982176a 100644 --- a/Application/Application.csproj +++ b/Application/Application.csproj @@ -1,11 +1,5 @@  - - net9.0 - enable - enable - - diff --git a/Application/ApplicationDependencyInjection.cs b/Application/ApplicationDependencyInjection.cs index 2cb1296..68622af 100644 --- a/Application/ApplicationDependencyInjection.cs +++ b/Application/ApplicationDependencyInjection.cs @@ -1,6 +1,6 @@ -using System.Reflection; -using Application.Helpers; +using Application.Helpers; using Application.Interfaces; +using Application.Profiles; using Application.Repositories; using Application.Services; using Microsoft.Extensions.DependencyInjection; @@ -13,7 +13,7 @@ public static class ApplicationDependencyInjection { public static IServiceCollection AddApplication(this IServiceCollection services) { - services.AddAutoMapper(Assembly.GetExecutingAssembly()); + services.AddAutoMapper(_ => {}, typeof(AllianceProfile)); services.AddScoped(); services.AddScoped(); diff --git a/Database/Database.csproj b/Database/Database.csproj index c37011e..7a1f17f 100644 --- a/Database/Database.csproj +++ b/Database/Database.csproj @@ -1,11 +1,5 @@  - - net9.0 - enable - enable - - diff --git a/Directory.Build.props b/Directory.Build.props index 672f9e3..4cb60ff 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - net9.0 + net10.0 enable enable diff --git a/Directory.Packages.props b/Directory.Packages.props index d3d5282..bf91889 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -3,37 +3,33 @@ true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Utilities/Utilities.csproj b/Utilities/Utilities.csproj index 72fbe04..b4100ce 100644 --- a/Utilities/Utilities.csproj +++ b/Utilities/Utilities.csproj @@ -1,20 +1,12 @@  - - net9.0 - enable - enable - - - - - - + +