Adds Configuration Manager + tests
This commit is contained in:
parent
55e65a1b21
commit
384cc3c6fd
16 changed files with 657 additions and 137 deletions
|
|
@ -0,0 +1,24 @@
|
|||
using System.Data;
|
||||
using Insight.Database;
|
||||
|
||||
namespace Configuration.Core;
|
||||
public class ConfigurationRepository : IConfigurationRepository
|
||||
{
|
||||
private readonly IDbConnection _connection;
|
||||
|
||||
public ConfigurationRepository(IDbConnection connection)
|
||||
{
|
||||
_connection = connection;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<AppConfiguration>> GetActiveConfigurations()
|
||||
{
|
||||
const string sql = @"
|
||||
SELECT id, key, value, label, content_type, valid_from, expires_at, created_at, modified_at, etag
|
||||
FROM prod.app_configuration
|
||||
WHERE (expires_at IS NULL OR expires_at > CURRENT_TIMESTAMP)
|
||||
AND (valid_from IS NULL OR valid_from <= CURRENT_TIMESTAMP)";
|
||||
|
||||
return await _connection.QueryAsync<AppConfiguration>(sql);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue