Add aggregate API

This commit is contained in:
2020-07-23 20:36:20 -04:00
parent f8a6c71dd0
commit e810c4a240
4 changed files with 88 additions and 0 deletions

View File

@@ -32,6 +32,14 @@ namespace ChrisKaczor.HomeMonitor.Weather.Service.Controllers
return (await _database.GetReadingHistory(start, end)).ToList();
}
[HttpGet("aggregate")]
public async Task<ActionResult<WeatherAggregate>> GetHistoryAggregate(DateTimeOffset start, DateTimeOffset end)
{
var readings = await _database.GetReadingHistory(start, end);
return new WeatherAggregate(readings);
}
[HttpGet("value-history")]
public async Task<ActionResult<List<WeatherValue>>> GetValueHistory(WeatherValueType weatherValueType, DateTimeOffset start, DateTimeOffset end)
{