🎯 Obiettivo
Implementare un servizio di notifiche interne per gestire reminder, segnalazioni e alert all'interno dell'applicazione (non email/SMS esterni, ma notifiche UI).
📋 Contesto
Scenari d'uso:
- Reminder visite imminenti: "Hai 2 visite programmate domani"
- Segnalazione progetti in scadenza: "Il progetto PTRP-2023-015 termina tra 7 giorni"
- Alert visite mancate non giustificate: "3 visite mancate senza registrazione nel mese corrente"
- Notifiche sync: "Nuovo pacchetto disponibile per l'importazione"
- Alert validazione: "5 progetti attivi senza educatori assegnati"
Queste notifiche appaiono:
- nella Dashboard come "notification center"
- come badge su icone sidebar
- come snackbar temporanee per eventi critici.
📦 Servizio da Implementare
INotificationService + NotificationService
Metodi principali (proposta):
public interface INotificationService
{
// Recupero notifiche
Task<IReadOnlyList<NotificationDto>> GetUnreadNotificationsAsync(
Guid operatorId,
CancellationToken ct = default);
Task<IReadOnlyList<NotificationDto>> GetAllNotificationsAsync(
Guid operatorId,
int maxCount = 50,
CancellationToken ct = default);
// Creazione notifiche
Task CreateNotificationAsync(
Guid targetOperatorId,
string title,
string message,
NotificationPriority priority,
string? actionUrl = null,
CancellationToken ct = default);
// Gestione stato
Task MarkAsReadAsync(Guid notificationId, CancellationToken ct = default);
Task MarkAllAsReadAsync(Guid operatorId, CancellationToken ct = default);
Task DismissAsync(Guid notificationId, CancellationToken ct = default);
// Generazione automatica notifiche
Task GenerateUpcomingVisitRemindersAsync(CancellationToken ct = default);
Task GenerateExpiringProjectAlertsAsync(CancellationToken ct = default);
Task GenerateMissedVisitAlertsAsync(CancellationToken ct = default);
}
public record NotificationDto(
Guid Id,
Guid TargetOperatorId,
string Title,
string Message,
NotificationPriority Priority,
DateTime CreatedAt,
bool IsRead,
string? ActionUrl // es. "/patients/{id}" per navigare alla scheda paziente
);
public enum NotificationPriority
{
Info,
Warning,
Error,
Critical
}
Modello Dati Notification
public class Notification
{
public Guid Id { get; set; }
public Guid TargetOperatorId { get; set; }
public ProfessionalEducatorModel TargetOperator { get; set; } = null!;
public string Title { get; set; } = string.Empty;
public string Message { get; set; } = string.Empty;
public NotificationPriority Priority { get; set; }
public DateTime CreatedAt { get; set; }
public bool IsRead { get; set; }
public DateTime? ReadAt { get; set; }
public bool IsDismissed { get; set; }
public string? ActionUrl { get; set; }
public string? RelatedEntityType { get; set; } // es. "Patient", "TherapyProject"
public Guid? RelatedEntityId { get; set; }
}
📋 Tasks
🎯 UI Integration (FASE 2-4)
✅ Acceptance Criteria
🔗 Riferimenti
CLUSTER: Services & Orchestrazione (gap 5.2)
FASE: 2-3 - Core Business / Polish
PRIORITÀ: 🔵 MEDIA
DIPENDENZE: #72, #73, #46
OPZIONALE: Migliora UX ma non bloccante per funzionalità core
🎯 Obiettivo
Implementare un servizio di notifiche interne per gestire reminder, segnalazioni e alert all'interno dell'applicazione (non email/SMS esterni, ma notifiche UI).
📋 Contesto
Scenari d'uso:
Queste notifiche appaiono:
📦 Servizio da Implementare
INotificationService+NotificationServiceMetodi principali (proposta):
Modello Dati
Notification📋 Tasks
NotificationinPTRP.Models/NotificationPriorityinPTRP.Models/Enums/INotificationServiceinPTRP.Services/Interfaces/NotificationServiceinPTRP.Services/INotificationRepositoryinPTRP.Data/🎯 UI Integration (FASE 2-4)
DashboardViewModelper mostrare notifiche in Dashboard✅ Acceptance Criteria
🔗 Riferimenti
CLUSTER: Services & Orchestrazione (gap 5.2)
FASE: 2-3 - Core Business / Polish
PRIORITÀ: 🔵 MEDIA
DIPENDENZE: #72, #73, #46
OPZIONALE: Migliora UX ma non bloccante per funzionalità core