big day behind me
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-05-19 04:33:53 +02:00
parent 4d4455679c
commit 8347b10401
36 changed files with 2291 additions and 284 deletions

View File

@@ -9,6 +9,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models;
using System.Reflection;
namespace HanyadikHetVan
{
@@ -21,14 +22,16 @@ namespace HanyadikHetVan
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(
Configuration.GetConnectionString("DefaultConnection")));
services.AddAutoMapper(Assembly.GetExecutingAssembly());
services.AddTransient<WeeklyTimeSpanService>();
services.AddTransient<PauseService>();
services.AddTransient<PurseService>();
services.AddTransient<HanyadikHetVanEntityService>();
services.AddTransient<HanyadikHetVanJsonService>();
services.AddTransient<HanyadikHetVanService>();
services.AddDatabaseDeveloperPageExceptionFilter();
@@ -65,13 +68,24 @@ namespace HanyadikHetVan
services.AddControllers();
services.AddApiVersioning(options =>
{
options.ReportApiVersions = true;
});
services.AddVersionedApiExplorer(options =>
{
options.GroupNameFormat = "'v'VVV";
options.SubstituteApiVersionInUrl = true;
});
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Hanyadik Het Van API", Version = "v1" });
c.SwaggerDoc("v2", new OpenApiInfo { Title = "Hanyadik Het Van API", Version = "v2" });
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
@@ -79,7 +93,11 @@ namespace HanyadikHetVan
app.UseDeveloperExceptionPage();
app.UseMigrationsEndPoint();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("v1/swagger.json", "HanyadikHetVan v1"));
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("v1/swagger.json", "Original API");
c.SwaggerEndpoint("v2/swagger.json", "Homework API");
});
}
else
{