refactor: code restructuring
This commit is contained in:
parent
de5dc274d7
commit
1c981fb7bf
@ -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;
|
||||
|
||||
|
@ -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;
|
@ -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
|
||||
{
|
@ -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
|
||||
{
|
@ -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
|
||||
{
|
@ -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
|
||||
{
|
@ -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
|
||||
{
|
@ -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
|
||||
{
|
@ -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
|
||||
{
|
@ -1,6 +0,0 @@
|
||||
namespace Mirea.Api.Endpoint.Configuration.General.Interfaces;
|
||||
|
||||
public interface IIsConfigured
|
||||
{
|
||||
bool IsConfigured();
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
namespace Mirea.Api.Endpoint.Common.Settings;
|
||||
namespace Mirea.Api.Endpoint.Common.Interfaces;
|
||||
public interface ISaveSettings
|
||||
{
|
||||
void SaveSetting();
|
@ -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
|
||||
{
|
@ -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
|
||||
{
|
@ -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;
|
@ -0,0 +1,6 @@
|
||||
namespace Mirea.Api.Endpoint.Configuration.ConfigurationChecks.Interfaces;
|
||||
|
||||
public interface IIsConfigured
|
||||
{
|
||||
bool IsConfigured();
|
||||
}
|
@ -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
|
@ -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
|
@ -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
|
||||
{
|
@ -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
|
@ -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
|
@ -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
|
||||
{
|
@ -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
|
||||
{
|
@ -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(
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user