From d8dbf1562f6be947077330b2bfe6d61ccda18fd0 Mon Sep 17 00:00:00 2001 From: Polianin Nikita Date: Sun, 27 Oct 2024 06:51:05 +0300 Subject: [PATCH] refactor: clean code --- .../Configuration/Core/BackgroundTasks/ScheduleSyncService.cs | 1 - Endpoint/Controllers/Configuration/SetupController.cs | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Endpoint/Configuration/Core/BackgroundTasks/ScheduleSyncService.cs b/Endpoint/Configuration/Core/BackgroundTasks/ScheduleSyncService.cs index 6186f3e..8d897ff 100644 --- a/Endpoint/Configuration/Core/BackgroundTasks/ScheduleSyncService.cs +++ b/Endpoint/Configuration/Core/BackgroundTasks/ScheduleSyncService.cs @@ -9,7 +9,6 @@ using Mirea.Api.Endpoint.Sync; using System; using System.Threading; using System.Threading.Tasks; -using IServiceProvider = System.IServiceProvider; namespace Mirea.Api.Endpoint.Configuration.Core.BackgroundTasks; diff --git a/Endpoint/Controllers/Configuration/SetupController.cs b/Endpoint/Controllers/Configuration/SetupController.cs index e306092..d0033ea 100644 --- a/Endpoint/Controllers/Configuration/SetupController.cs +++ b/Endpoint/Controllers/Configuration/SetupController.cs @@ -161,13 +161,13 @@ public class SetupController( } else if (Directory.GetDirectories(path).Length != 0 || !Directory.GetFiles(path).Select(x => string.Equals(Path.GetFileName(x), "database.db3")).All(x => x)) + { throw new ControllerArgumentException("Such a folder exists. Enter a different name"); + } var filePath = Path.Combine(path, "database.db3"); var connectionString = $"Data Source={filePath}"; - //System.IO.File.Create(filePath); - var result = SetDatabase(connectionString, DbSettings.DatabaseEnum.Sqlite); foreach (var file in Directory.GetFiles(path))