PlanTempusApp/Core/Configurations/ConfigurationManager/ConfigurationRepository.cs

24 lines
788 B
C#
Raw Normal View History

2025-01-26 22:57:27 +01:00
using System.Data;
using Insight.Database;
namespace Configuration.Core;
2025-01-28 14:51:09 +01:00
public class ConfigurationRepository : IConfigurationRepository
2025-01-26 22:57:27 +01:00
{
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
2025-01-28 14:51:09 +01:00
WHERE (expires_at IS NULL OR expires_at <= CURRENT_TIMESTAMP)
AND (valid_from IS NULL OR valid_from >= CURRENT_TIMESTAMP)";
2025-01-26 22:57:27 +01:00
return await _connection.QueryAsync<AppConfiguration>(sql);
}
}