From 6094206cbcafa108c0742fb59a88bbd11aad1107 Mon Sep 17 00:00:00 2001 From: Arnaud Dartois Date: Fri, 17 Jul 2026 19:25:52 +0000 Subject: [PATCH] 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. --- src/Heimdall.Api/Controllers/StatsController.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Heimdall.Api/Controllers/StatsController.cs b/src/Heimdall.Api/Controllers/StatsController.cs index 9ca8a5d..31f33d1 100644 --- a/src/Heimdall.Api/Controllers/StatsController.cs +++ b/src/Heimdall.Api/Controllers/StatsController.cs @@ -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 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 }); } }