refactor: code restructuring

This commit is contained in:
Polianin Nikita 2024-10-07 02:13:35 +03:00
parent de5dc274d7
commit 1c981fb7bf
29 changed files with 57 additions and 56 deletions

View File

@ -1,4 +1,4 @@
using Mirea.Api.Endpoint.Configuration.General.Settings;
using Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Settings;
using System.Collections.Generic;
using System.Linq;

View File

@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Mirea.Api.Endpoint.Common.Attributes;
using Mirea.Api.Endpoint.Common.Settings;
using Mirea.Api.Endpoint.Configuration.Model;
using System;
using System.Reflection;
using System.Threading.Tasks;

View File

@ -1,7 +1,7 @@
using Asp.Versioning;
using Microsoft.Extensions.DependencyInjection;
namespace Mirea.Api.Endpoint.Configuration.ApplicationConfiguration;
namespace Mirea.Api.Endpoint.Configuration.Core.Startup;
public static class ApiVersioningConfiguration
{

View File

@ -1,9 +1,9 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Mirea.Api.Endpoint.Common.Settings;
using Mirea.Api.Endpoint.Configuration.General.Settings;
using Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Settings;
using Mirea.Api.Endpoint.Configuration.Model;
namespace Mirea.Api.Endpoint.Configuration.ApplicationConfiguration;
namespace Mirea.Api.Endpoint.Configuration.Core.Startup;
public static class CacheConfiguration
{

View File

@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Mirea.Api.Endpoint.Configuration.ApplicationConfiguration;
namespace Mirea.Api.Endpoint.Configuration.Core.Startup;
public static class EnvironmentConfiguration
{

View File

@ -7,7 +7,7 @@ using Mirea.Api.Security.Common.Interfaces;
using System;
using System.Text;
namespace Mirea.Api.Endpoint.Configuration.ApplicationConfiguration;
namespace Mirea.Api.Endpoint.Configuration.Core.Startup;
public static class JwtConfiguration
{

View File

@ -2,14 +2,14 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Mirea.Api.Endpoint.Common.Services;
using Mirea.Api.Endpoint.Common.Settings;
using Mirea.Api.Endpoint.Configuration.Model;
using Serilog;
using Serilog.Events;
using Serilog.Filters;
using Serilog.Formatting.Compact;
using System.IO;
namespace Mirea.Api.Endpoint.Configuration.ApplicationConfiguration;
namespace Mirea.Api.Endpoint.Configuration.Core.Startup;
public static class LoggerConfiguration
{

View File

@ -1,12 +1,12 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Mirea.Api.Endpoint.Common.Services.Security;
using Mirea.Api.Endpoint.Common.Settings;
using Mirea.Api.Endpoint.Configuration.General.Settings;
using Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Settings;
using Mirea.Api.Endpoint.Configuration.Model;
using Mirea.Api.Security;
using Mirea.Api.Security.Common.Interfaces;
namespace Mirea.Api.Endpoint.Configuration.ApplicationConfiguration;
namespace Mirea.Api.Endpoint.Configuration.Core.Startup;
public static class SecureConfiguration
{

View File

@ -9,7 +9,7 @@ using Swashbuckle.AspNetCore.SwaggerGen;
using System;
using System.IO;
namespace Mirea.Api.Endpoint.Configuration.ApplicationConfiguration;
namespace Mirea.Api.Endpoint.Configuration.Core.Startup;
public static class SwaggerConfiguration
{

View File

@ -1,6 +0,0 @@
namespace Mirea.Api.Endpoint.Configuration.General.Interfaces;
public interface IIsConfigured
{
bool IsConfigured();
}

View File

@ -1,4 +1,4 @@
namespace Mirea.Api.Endpoint.Common.Settings;
namespace Mirea.Api.Endpoint.Common.Interfaces;
public interface ISaveSettings
{
void SaveSetting();

View File

@ -1,9 +1,10 @@
using Mirea.Api.Endpoint.Common.Services;
using Mirea.Api.Endpoint.Common.Interfaces;
using Mirea.Api.Endpoint.Common.Services;
using System.IO;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Mirea.Api.Endpoint.Common.Settings;
namespace Mirea.Api.Endpoint.Configuration.Model;
public class Admin : ISaveSettings
{

View File

@ -1,10 +1,11 @@
using Mirea.Api.Endpoint.Common.Services;
using Mirea.Api.Endpoint.Configuration.General.Settings;
using Mirea.Api.Endpoint.Common.Interfaces;
using Mirea.Api.Endpoint.Common.Services;
using Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Settings;
using System.IO;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Mirea.Api.Endpoint.Common.Settings;
namespace Mirea.Api.Endpoint.Configuration.Model;
public class GeneralConfig : ISaveSettings
{

View File

@ -1,6 +1,6 @@
using System;
namespace Mirea.Api.Endpoint.Configuration.General.Attributes;
namespace Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Attributes;
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public class RequiredSettingsAttribute : Attribute;

View File

@ -0,0 +1,6 @@
namespace Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Interfaces;
public interface IIsConfigured
{
bool IsConfigured();
}

View File

@ -1,7 +1,7 @@
using Mirea.Api.Endpoint.Configuration.General.Attributes;
using Mirea.Api.Endpoint.Configuration.General.Interfaces;
using Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Attributes;
using Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Interfaces;
namespace Mirea.Api.Endpoint.Configuration.General.Settings;
namespace Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Settings;
[RequiredSettings]
public class CacheSettings : IIsConfigured

View File

@ -1,10 +1,10 @@
using Mirea.Api.DataAccess.Persistence.Common;
using Mirea.Api.Endpoint.Configuration.General.Attributes;
using Mirea.Api.Endpoint.Configuration.General.Interfaces;
using Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Attributes;
using Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Interfaces;
using System;
using System.Text.Json.Serialization;
namespace Mirea.Api.Endpoint.Configuration.General.Settings;
namespace Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Settings;
[RequiredSettings]
public class DbSettings : IIsConfigured

View File

@ -1,6 +1,6 @@
using Mirea.Api.Endpoint.Configuration.General.Interfaces;
using Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Interfaces;
namespace Mirea.Api.Endpoint.Configuration.General.Settings;
namespace Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Settings;
public class EmailSettings : IIsConfigured
{

View File

@ -1,7 +1,7 @@
using Mirea.Api.Endpoint.Configuration.General.Attributes;
using Mirea.Api.Endpoint.Configuration.General.Interfaces;
using Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Attributes;
using Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Interfaces;
namespace Mirea.Api.Endpoint.Configuration.General.Settings;
namespace Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Settings;
[RequiredSettings]
public class LogSettings : IIsConfigured

View File

@ -1,10 +1,10 @@
using Mirea.Api.Endpoint.Configuration.General.Attributes;
using Mirea.Api.Endpoint.Configuration.General.Interfaces;
using Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Attributes;
using Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Mirea.Api.Endpoint.Configuration.General.Settings;
namespace Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Settings;
[RequiredSettings]
public class ScheduleSettings : IIsConfigured

View File

@ -1,7 +1,7 @@
using Mirea.Api.Endpoint.Common.Interfaces;
using System;
namespace Mirea.Api.Endpoint.Configuration.General;
namespace Mirea.Api.Endpoint.Configuration.ConfigurationChecks;
public class SetupTokenService : ISetupToken
{

View File

@ -1,11 +1,11 @@
using Microsoft.Extensions.Options;
using Mirea.Api.Endpoint.Common.Settings;
using Mirea.Api.Endpoint.Configuration.General.Attributes;
using Mirea.Api.Endpoint.Configuration.General.Interfaces;
using Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Attributes;
using Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Interfaces;
using Mirea.Api.Endpoint.Configuration.Model;
using System;
using System.Reflection;
namespace Mirea.Api.Endpoint.Configuration.General.Validators;
namespace Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Validators;
public class SettingsRequiredValidator
{

View File

@ -10,9 +10,9 @@ using Mirea.Api.Endpoint.Common.Attributes;
using Mirea.Api.Endpoint.Common.Exceptions;
using Mirea.Api.Endpoint.Common.Interfaces;
using Mirea.Api.Endpoint.Common.Services;
using Mirea.Api.Endpoint.Common.Settings;
using Mirea.Api.Endpoint.Configuration.General.Settings;
using Mirea.Api.Endpoint.Configuration.General.Validators;
using Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Settings;
using Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Validators;
using Mirea.Api.Endpoint.Configuration.Model;
using Mirea.Api.Security.Services;
using MySqlConnector;
using Npgsql;
@ -29,7 +29,6 @@ using System.Security.Cryptography;
namespace Mirea.Api.Endpoint.Controllers.Configuration;
[ApiVersion("1.0")]
[ApiController]
[MaintenanceModeIgnore]
[ApiExplorerSettings(IgnoreApi = true)]
public class SetupController(

View File

@ -10,7 +10,7 @@ using Mirea.Api.Dto.Responses;
using Mirea.Api.Endpoint.Common.Attributes;
using Mirea.Api.Endpoint.Common.Exceptions;
using Mirea.Api.Endpoint.Common.Services;
using Mirea.Api.Endpoint.Common.Settings;
using Mirea.Api.Endpoint.Configuration.Model;
using Mirea.Api.Security.Common.Dto.Requests;
using Mirea.Api.Security.Services;
using System;

View File

@ -9,7 +9,7 @@ using Mirea.Api.Dto.Requests;
using Mirea.Api.Dto.Responses;
using Mirea.Api.Endpoint.Common.Attributes;
using Mirea.Api.Endpoint.Common.Services;
using Mirea.Api.Endpoint.Common.Settings;
using Mirea.Api.Endpoint.Configuration.Model;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -10,10 +10,10 @@ using Mirea.Api.DataAccess.Persistence;
using Mirea.Api.DataAccess.Persistence.Common;
using Mirea.Api.Endpoint.Common.Interfaces;
using Mirea.Api.Endpoint.Common.Services;
using Mirea.Api.Endpoint.Common.Settings;
using Mirea.Api.Endpoint.Configuration.ApplicationConfiguration;
using Mirea.Api.Endpoint.Configuration.General;
using Mirea.Api.Endpoint.Configuration.General.Validators;
using Mirea.Api.Endpoint.Configuration.ConfigurationChecks;
using Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Validators;
using Mirea.Api.Endpoint.Configuration.Core.Startup;
using Mirea.Api.Endpoint.Configuration.Model;
using Mirea.Api.Endpoint.Middleware;
using Mirea.Api.Security.Services;
using System;