mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-01-14 01:25:38 -05:00
Add power database support
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ChrisKaczor.HomeMonitor.Power.Service.Controllers
|
||||
{
|
||||
[Route("[controller]")]
|
||||
[ApiController]
|
||||
public class ReadingsController : ControllerBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
28
Power/Service/Controllers/StatusController.cs
Normal file
28
Power/Service/Controllers/StatusController.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using ChrisKaczor.HomeMonitor.Power.Service.Data;
|
||||
using ChrisKaczor.HomeMonitor.Power.Service.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ChrisKaczor.HomeMonitor.Power.Service.Controllers
|
||||
{
|
||||
[Route("[controller]")]
|
||||
[ApiController]
|
||||
public class StatusController : ControllerBase
|
||||
{
|
||||
private readonly Database _database;
|
||||
|
||||
public StatusController(Database database)
|
||||
{
|
||||
_database = database;
|
||||
}
|
||||
|
||||
[HttpGet("history-grouped")]
|
||||
public async Task<ActionResult<List<PowerStatusGrouped>>> GetHistoryGrouped(DateTimeOffset start, DateTimeOffset end, int bucketMinutes = 2)
|
||||
{
|
||||
return (await _database.GetStatusHistoryGrouped(start, end, bucketMinutes)).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user