Release v1.0.0 #16
.envDbInitializer.csDependencyInjection.csPersistence.csprojUberDbContext.cs
.gitea/workflows
ApiDto
ApiDto.csproj
Common
Requests
Responses
Application
Application.csprojDependencyInjection.cs
Backend.slnCommon
Behaviors
Exceptions
Mappings
Cqrs
Campus
Queries
Discipline
Queries
Faculty
Queries
Group
Queries
LectureHall
Queries
Professor
Queries
Schedule
Interfaces
Domain/Schedule
Campus.csDiscipline.csFaculty.csGroup.csLectureHall.csLesson.csLessonAssociation.csProfessor.csSpecificWeek.csTypeOfOccupation.cs
Endpoint
Common
Attributes
Interfaces
Services
Configuration
EnvironmentManager.cs
General
Swagger
Controllers
BaseController.cs
Endpoint.csprojV1
CampusController.csDisciplineController.csFacultyController.csGroupController.csLectureHallController.csProfessorController.csScheduleController.cs
WeatherForecastController.csMiddleware
Program.csWeatherForecast.csPersistence
Contexts
Schedule
EntityTypeConfigurations
Schedule
@ -12,6 +12,7 @@ using Mirea.Api.Endpoint.Common.Interfaces;
|
||||
using Mirea.Api.Endpoint.Common.Services;
|
||||
using Mirea.Api.Endpoint.Configuration;
|
||||
using Mirea.Api.Endpoint.Configuration.General;
|
||||
using Mirea.Api.Endpoint.Configuration.General.Validators;
|
||||
using Mirea.Api.Endpoint.Configuration.Swagger;
|
||||
using Mirea.Api.Endpoint.Middleware;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
@ -100,8 +101,25 @@ public class Program
|
||||
Console.WriteLine($"{item.Key}:{item.Value}");
|
||||
#endif
|
||||
|
||||
var uber = app.Services.CreateScope().ServiceProvider.GetService<UberDbContext>();
|
||||
DbInitializer.Initialize(uber!);
|
||||
using (var scope = app.Services.CreateScope())
|
||||
{
|
||||
var serviceProvider = scope.ServiceProvider;
|
||||
|
||||
var optionsSnapshot = serviceProvider.GetRequiredService<IOptionsSnapshot<GeneralConfig>>();
|
||||
var settingsValidator = new SettingsRequiredValidator(optionsSnapshot);
|
||||
var isDoneConfig = settingsValidator.AreSettingsValid();
|
||||
|
||||
if (isDoneConfig)
|
||||
{
|
||||
var uberDbContext = serviceProvider.GetRequiredService<UberDbContext>();
|
||||
var maintenanceModeService = serviceProvider.GetRequiredService<IMaintenanceModeNotConfigureService>();
|
||||
|
||||
maintenanceModeService.DisableMaintenanceMode();
|
||||
DbInitializer.Initialize(uberDbContext);
|
||||
|
||||
// todo: if admin not found
|
||||
}
|
||||
}
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
|
Reference in New Issue
Block a user