feat(cqrs): update controllers, add AutoMapper profiles, SignalR notifications, Hangfire config

- 13 controllers migrated from service DI to IMediator dispatch
- 11 AutoMapper mapping profiles (Sites, Cameras, Auth, Users, Agents, Events, Assignments, Settings, Groups, Persons, Discovery)
- SignalR notifications bridged via MediatR INotificationHandler
- Hangfire config moved from Program.cs to Infrastructure/BackgroundJobs
- 0 build errors, 0 warnings
This commit is contained in:
Arnaud Dartois committed 2026-07-22 19:54:55 +00:00
1 parent c1b3b3d3b4
commit 1d1ac8387e
33 files changed
+611 -195

No files matched your search

@@ -1,6 +1,8 @@
using Heimdall.Application.DTOs;
using Heimdall.Application.Services;
using Heimdall.Application.Stats.Queries.GetStats;
using Heimdall.Application.Stats.Queries.GetAgentStats;
using Heimdall.Infrastructure.Security;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.RateLimiting;
@@ -12,9 +14,9 @@ namespace Heimdall.Api.Controllers;
[EnableRateLimiting("Api")]
public class StatsController : ControllerBase
{
private readonly IStatsService _statsService;
private readonly IMediator _mediator;
public StatsController(IStatsService statsService) => _statsService = statsService;
public StatsController(IMediator mediator) => _mediator = mediator;
/// <summary>Get system-wide statistics.</summary>
[Authorize(AuthenticationSchemes = "JwtBearer", Policy = AppPermissions.SiteRead)]
@@ -23,7 +25,7 @@ public class StatsController : ControllerBase
[ProducesResponseType(typeof(void), StatusCodes.Status400BadRequest)]
public async Task<IActionResult> GetStats(CancellationToken ct)
{
var result = await _statsService.GetStatsAsync(ct);
var result = await _mediator.Send(new GetStatsQuery(), ct);
if (!result.IsSuccess)
return StatusCode(result.StatusCode ?? 400, new { error = result.Error });
return Ok(new { data = result.Data, timestamp = DateTime.UtcNow });
@@ -36,7 +38,7 @@ public class StatsController : ControllerBase
[ProducesResponseType(typeof(void), StatusCodes.Status400BadRequest)]
public async Task<IActionResult> GetAgentStats(CancellationToken ct)
{
var result = await _statsService.GetAgentStatsAsync(ct);
var result = await _mediator.Send(new GetAgentStatsQuery(), ct);
if (!result.IsSuccess)
return StatusCode(result.StatusCode ?? 400, new { error = result.Error });
return Ok(result.Data);