Introduced NotificationService for managing notification logic and recipient resolution.

- Integrated SignalR for real-time notification delivery to users.
This commit is contained in:
2026-10-20 16:51:01 +05:30
parent a0df2a1bbf
commit 6b9f27573b
8 changed files with 6649 additions and 84 deletions
+33
View File
@@ -0,0 +1,33 @@
using System.ComponentModel.DataAnnotations;
namespace Distribution.Models
{
public enum NotificationSeverity { Info, Success, Warning, Critical }
/// <summary>One row per event. Who it was delivered to lives in <see cref="NotificationRecipient"/>.</summary>
public class Notification : Template
{
[MaxLength(60)]
public string Type { get; set; } = string.Empty;
public NotificationSeverity Severity { get; set; }
[MaxLength(150)]
public string Title { get; set; } = string.Empty;
[MaxLength(500)]
public string Message { get; set; } = string.Empty;
[MaxLength(50)]
public string EntityType { get; set; } = string.Empty;
public Guid EntityId { get; set; }
[MaxLength(200)]
public string Link { get; set; } = string.Empty;
public Guid? CreatedByUserId { get; set; }
public ICollection<NotificationRecipient> Recipients { get; set; } = new List<NotificationRecipient>();
}
}
@@ -0,0 +1,19 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Distribution.Models
{
/// <summary>One row per user per notification, so read state is per user.</summary>
public class NotificationRecipient : Template
{
public Guid FK_NotificationId { get; set; }
[ForeignKey("FK_NotificationId")]
public Notification Notification { get; set; }
public Guid FK_UserId { get; set; }
[ForeignKey("FK_UserId")]
public User User { get; set; }
public bool IsRead { get; set; }
public DateTime? ReadAt { get; set; }
}
}