mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-02-14 11:28:30 -05:00
Add some initial history APIs
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using ChrisKaczor.HomeMonitor.Weather.Models;
|
||||
using ChrisKaczor.HomeMonitor.Weather.Service.Models;
|
||||
using Dapper;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
@@ -96,5 +97,16 @@ namespace ChrisKaczor.HomeMonitor.Weather.Service.Data
|
||||
|
||||
return await connection.QueryAsync<WeatherReading>(query, new { Start = start, End = end });
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<WeatherValue>> GetReadingValueHistory(WeatherValueType weatherValueType, DateTimeOffset start, DateTimeOffset end, int bucketMinutes)
|
||||
{
|
||||
await using var connection = CreateConnection();
|
||||
|
||||
var query = ResourceReader.GetString("ChrisKaczor.HomeMonitor.Weather.Service.Data.Resources.GetReadingValueHistory.sql");
|
||||
|
||||
query = query.Replace("@Value", weatherValueType.ToString());
|
||||
|
||||
return await connection.QueryAsync<WeatherValue>(query, new { Start = start, End = end, BucketMinutes = bucketMinutes });
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user