fix(pipeline): version detection profiles and resync camera configuration

This commit is contained in:
Arnaud Dartois committed 2026-10-20 02:27:19 +02:00
1 parent 64a769c7de
commit 8c6ecccf49
20 files changed
+337 -102

No files matched your search

@@ -1,4 +1,5 @@
using Heimdall.Application.Common;
using System.Text.Json;
using Heimdall.Application.DTOs;
using Heimdall.Application.Security;
using Heimdall.Domain.Enums;
@@ -81,6 +82,7 @@ public class GetEffectiveAgentConfigQueryHandler
// carries them to the agent without a new API surface.
var cameras = await _db.Cameras
.AsNoTracking()
.Include(c => c.DetectionProfile)
.Where(c => c.AgentId == request.AgentId && !c.IsDeleted)
.ToListAsync(ct)
.ConfigureAwait(false);
@@ -88,6 +90,16 @@ public class GetEffectiveAgentConfigQueryHandler
foreach (var camera in cameras)
{
var prefix = $"camera.{camera.Id}";
var p = camera.DetectionProfile;
var profile = p is null ? new DetectionProfileDto() : new DetectionProfileDto
{
IdleIntervalMs = p.IdleIntervalMs, MotionIntervalMs = p.MotionIntervalMs, ActiveIntervalMs = p.ActiveIntervalMs,
MinConfidence = (float)p.MinConfidence, DetectPerson = p.DetectPerson,
DetectVehicle = p.DetectVehicle, DetectAnimal = p.DetectAnimal, DetectPackage = p.DetectPackage,
DetectMotion = p.DetectMotion, RequireMotionForAI = p.RequireMotionForAI,
MotionThreshold = p.MotionThreshold, YoloModel = p.YoloModel
};
config[$"{prefix}.profile"] = p?.ExecutionProfileJson ?? JsonSerializer.Serialize(profile);
config[$"{prefix}.name"] = camera.Name;
if (!string.IsNullOrWhiteSpace(camera.RtspUrl))
config[$"{prefix}.rtsp"] = camera.RtspUrl;