diff --git a/AsbCloudApp/Services/IWellService.cs b/AsbCloudApp/Services/IWellService.cs index a1df94f3..edea98ae 100644 --- a/AsbCloudApp/Services/IWellService.cs +++ b/AsbCloudApp/Services/IWellService.cs @@ -97,13 +97,6 @@ namespace AsbCloudApp.Services /// DatesRangeDto GetDatesRange(int idWell); - /// - /// Проверить задан ли у скважины часовой пояс и задать его если он не задан - /// - /// - /// - Task EnshureTimezonesIsSetAsync(CancellationToken token); - /// /// ВРЕМЕННЫЙ метод /// diff --git a/AsbCloudInfrastructure/Services/WellService.cs b/AsbCloudInfrastructure/Services/WellService.cs index 4cf88d82..c47dd204 100644 --- a/AsbCloudInfrastructure/Services/WellService.cs +++ b/AsbCloudInfrastructure/Services/WellService.cs @@ -300,26 +300,6 @@ namespace AsbCloudInfrastructure.Services return dto; } - public async Task EnshureTimezonesIsSetAsync(CancellationToken token) - { - var cache = await GetCacheAsync(token); - if (!cache.Any(w => w.Timezone is null)) - return; - - var defaultTimeZone = new SimpleTimezone - { - Hours = 5, - IsOverride = false, - TimezoneId = "Assumed", - }; - - await dbSet.Where(w => w.Timezone == null) - .ForEachAsync(w => w.Timezone = defaultTimeZone, token); - - await dbContext.SaveChangesAsync(token); - DropCache(); - } - public SimpleTimezoneDto GetTimezone(int idWell) { var well = GetOrDefault(idWell); diff --git a/AsbCloudInfrastructure/Startup.cs b/AsbCloudInfrastructure/Startup.cs index 207270c2..5cd670fd 100644 --- a/AsbCloudInfrastructure/Startup.cs +++ b/AsbCloudInfrastructure/Startup.cs @@ -27,9 +27,7 @@ namespace AsbCloudInfrastructure context.Database.SetCommandTimeout(TimeSpan.FromSeconds(2 * 60)); context.Database.Migrate(); - var wellService = provider.GetRequiredService(); - wellService.EnshureTimezonesIsSetAsync(CancellationToken.None).Wait();// TODO: make this background work - + // TODO: Сделать инициализацию кеша телеметрии более явной. _ = provider.GetRequiredService>(); _ = provider.GetRequiredService>(); diff --git a/AsbCloudWebApi/Controllers/AdminWellController.cs b/AsbCloudWebApi/Controllers/AdminWellController.cs index 4a670652..ac08b383 100644 --- a/AsbCloudWebApi/Controllers/AdminWellController.cs +++ b/AsbCloudWebApi/Controllers/AdminWellController.cs @@ -18,13 +18,5 @@ namespace AsbCloudWebApi.Controllers public AdminWellController(IWellService service) : base(service) { } - - [HttpPost("EnshureTimezonesIsSet")] - [Permission] - public async Task EnshureTimezonesIsSet(CancellationToken token) - { - await ((IWellService)service).EnshureTimezonesIsSetAsync(token); - return Ok(); - } } }