24 lines
No EOL
788 B
C#
24 lines
No EOL
788 B
C#
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);
|
|
}
|
|
} |