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)
48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using Heimdall.Domain.Entities;
|
|
using Heimdall.Domain.Enums;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace Heimdall.Infrastructure.Data.Configurations;
|
|
|
|
public class NotificationTemplateConfiguration : IEntityTypeConfiguration<NotificationTemplate>
|
|
{
|
|
public void Configure(EntityTypeBuilder<NotificationTemplate> builder)
|
|
{
|
|
builder.ToTable("notification_templates");
|
|
|
|
builder.HasKey(t => t.Id);
|
|
|
|
builder.Property(t => t.EventType)
|
|
.HasConversion<string>()
|
|
.HasMaxLength(50)
|
|
.IsRequired();
|
|
|
|
builder.Property(t => t.Channel)
|
|
.HasConversion<string>()
|
|
.HasMaxLength(50)
|
|
.IsRequired();
|
|
|
|
builder.Property(t => t.Language)
|
|
.HasMaxLength(10)
|
|
.IsRequired()
|
|
.HasDefaultValue("fr");
|
|
|
|
builder.Property(t => t.Subject)
|
|
.HasMaxLength(200)
|
|
.IsRequired();
|
|
|
|
builder.Property(t => t.BodyMarkdown)
|
|
.IsRequired();
|
|
|
|
builder.Property(t => t.CreatedAt)
|
|
.HasDefaultValueSql("NOW()");
|
|
|
|
builder.Property(t => t.UpdatedAt)
|
|
.HasDefaultValueSql("NOW()");
|
|
|
|
// Indexes
|
|
builder.HasIndex(t => new { t.EventType, t.Channel, t.Language }).IsUnique();
|
|
}
|
|
}
|