feat: add a return of the data that has been configured
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using Mirea.Api.Endpoint.Configuration.Validation.Attributes;
|
||||
using Mirea.Api.Dto.Common;
|
||||
using Mirea.Api.Endpoint.Configuration.Validation.Attributes;
|
||||
using Mirea.Api.Endpoint.Configuration.Validation.Interfaces;
|
||||
|
||||
namespace Mirea.Api.Endpoint.Configuration.Model.GeneralSettings;
|
||||
@ -6,18 +7,12 @@ namespace Mirea.Api.Endpoint.Configuration.Model.GeneralSettings;
|
||||
[RequiredSettings]
|
||||
public class CacheSettings : IIsConfigured
|
||||
{
|
||||
public enum CacheEnum
|
||||
{
|
||||
Memcached,
|
||||
Redis
|
||||
}
|
||||
|
||||
public CacheEnum TypeDatabase { get; set; }
|
||||
public CacheType TypeDatabase { get; set; }
|
||||
public string? ConnectionString { get; set; }
|
||||
|
||||
public bool IsConfigured()
|
||||
{
|
||||
return TypeDatabase == CacheEnum.Memcached ||
|
||||
return TypeDatabase == CacheType.Memcached ||
|
||||
!string.IsNullOrEmpty(ConnectionString);
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using Mirea.Api.DataAccess.Persistence.Common;
|
||||
using Mirea.Api.Dto.Common;
|
||||
using Mirea.Api.Endpoint.Configuration.Validation.Attributes;
|
||||
using Mirea.Api.Endpoint.Configuration.Validation.Interfaces;
|
||||
using System;
|
||||
@ -9,22 +10,16 @@ namespace Mirea.Api.Endpoint.Configuration.Model.GeneralSettings;
|
||||
[RequiredSettings]
|
||||
public class DbSettings : IIsConfigured
|
||||
{
|
||||
public enum DatabaseEnum
|
||||
{
|
||||
Mysql,
|
||||
Sqlite,
|
||||
PostgresSql
|
||||
}
|
||||
public DatabaseEnum TypeDatabase { get; set; }
|
||||
public DatabaseType TypeDatabase { get; set; }
|
||||
public required string ConnectionStringSql { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public DatabaseProvider DatabaseProvider =>
|
||||
TypeDatabase switch
|
||||
{
|
||||
DatabaseEnum.PostgresSql => DatabaseProvider.Postgresql,
|
||||
DatabaseEnum.Mysql => DatabaseProvider.Mysql,
|
||||
DatabaseEnum.Sqlite => DatabaseProvider.Sqlite,
|
||||
DatabaseType.PostgresSql => DatabaseProvider.Postgresql,
|
||||
DatabaseType.Mysql => DatabaseProvider.Mysql,
|
||||
DatabaseType.Sqlite => DatabaseProvider.Sqlite,
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user