From 286154692eb3cf731a8ff6f6ab516d305ee50736 Mon Sep 17 00:00:00 2001 From: Frolov-Nikita Date: Tue, 8 Aug 2023 12:24:44 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=20=D0=BD?= =?UTF-8?q?=D0=B5=20=D0=B0=D0=BA=D1=82=D1=83=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B?= =?UTF-8?q?=D0=B9=20=D0=BA=D0=BE=D1=81=D1=82=D1=8B=D0=BB=D1=8C.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudApp/Services/IWellService.cs | 7 ------- .../Services/WellService.cs | 20 ------------------- AsbCloudInfrastructure/Startup.cs | 4 +--- .../Controllers/AdminWellController.cs | 8 -------- 4 files changed, 1 insertion(+), 38 deletions(-) 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(); - } } }