feat: implémenter SignalR hubs (Monitoring, Notifications, Admin) + système de notifications complet

SignalR Hubs:
- MonitoringHub (/hubs/monitoring) — statuts agents/caméras/stockage/GPU jobs
- NotificationsHub (/hubs/notifications) — notifications in-app badge temps réel
- AdminHub (/hubs/admin) — broadcast changements config (Admin only)

Notification System:
- Nouvelles entités: Notification, NotificationTemplate, UserNotificationConfig
- CQRS/MediatR: 6 handlers (list, unread, mark-read, mark-all, config get/update)
- Infrastructure: NotificationService orchestrator + EmailService + GotifyService
- Rate limiter IMemoryCache (20 events/min/camera/type)
- Hangfire jobs: SendNotification, DailyDigest, WeeklyDigest
- NotificationsController API (6 endpoints)
- Blazor UI: NotificationsPage + NotificationBadge
- Migration AddNotifications (3 nouvelles tables)
- 644 nouveaux tests (Domain: 131, Application: 321, Infra: 151, Integration: 120, +autres)
This commit is contained in:
Arnaud Dartois committed 2026-07-26 20:45:35 +00:00
1 parent ef3ea9d1ca
commit f9be0f1e0d
62 files changed
+6664 -3

No files matched your search

@@ -0,0 +1,61 @@
using Heimdall.Domain.Enums;
using Heimdall.Domain.Primitives;
namespace Heimdall.Domain.Entities;
/// <summary>
/// Per-user notification preferences including channel configuration,
/// language, digest schedule, and subscribed event types.
/// </summary>
public class UserNotificationConfig : Entity<Guid>, IAuditableEntity
{
public Guid UserId { get; private set; }
public bool EmailEnabled { get; private set; }
public string? EmailAddress { get; private set; }
public bool GotifyEnabled { get; private set; }
public string? GotifyUrl { get; private set; }
public string? GotifyToken { get; private set; }
public string Language { get; private set; } = "fr";
public bool DailyDigest { get; private set; }
public bool WeeklyDigest { get; private set; }
public string? SubscribedEventsJson { get; private set; } // JSON array of EventType values
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
private UserNotificationConfig() { } // EF Core
public UserNotificationConfig(Guid userId)
: base(Guid.NewGuid())
{
UserId = userId;
}
public void UpdateEmail(string? emailAddress, bool enabled)
{
EmailAddress = emailAddress;
EmailEnabled = enabled;
}
public void UpdateGotify(string? url, string? token, bool enabled)
{
GotifyUrl = url;
GotifyToken = token;
GotifyEnabled = enabled;
}
public void UpdateDigests(bool daily, bool weekly)
{
DailyDigest = daily;
WeeklyDigest = weekly;
}
public void SetSubscribedEvents(string? subscribedEventsJson)
{
SubscribedEventsJson = subscribedEventsJson;
}
public void SetLanguage(string language)
{
Language = language;
}
}