fix(api): return typed StatsResponse DTO instead of anonymous object

StatsController was constructing an anonymous response object that
differed from the StatsResponse DTO shape. Now wraps the actual DTO
in a standard envelope { data, timestamp } consistent with the rest
of the API.
This commit is contained in:
Arnaud Dartois committed 2026-07-17 19:25:52 +00:00
1 parent e5e88ff83f
commit 6094206cbc
1 file changed
+2 -9
@@ -1,3 +1,4 @@
using Heimdall.Application.DTOs;
using Heimdall.Application.Services;
using Heimdall.Infrastructure.Security;
using Microsoft.AspNetCore.Authorization;
@@ -18,14 +19,6 @@ public class StatsController : ControllerBase
public async Task<IActionResult> GetStats(CancellationToken ct)
{
var stats = await _statsService.GetStatsAsync(ct);
return Ok(new
{
totalSites = stats.TotalSites,
totalCameras = stats.TotalCameras,
totalAgents = stats.TotalAgents,
onlineAgents = stats.OnlineAgents,
activeSites = stats.ActiveSites,
timestamp = DateTime.UtcNow
});
return Ok(new { data = stats, timestamp = DateTime.UtcNow });
}
}