[CLAUDE] App+Domain+Infra+Api+FE: Notifications module end-to-end
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m43s
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m43s
Domain: - Notification entity + NotificationType enum (stable ints) - Nullable RefId cho correlation (contract, user, ...) Infrastructure: - NotificationConfiguration: bảng Notifications, index theo (UserId, ReadAt) - NotificationService: ghi vào DbContext, không SaveChanges (để caller quyết định unit-of-work — đảm bảo atomic với domain mutation) - EF migration AddNotifications Application: - INotificationService (Notify + NotifyMany) - CQRS: ListMyNotifications / GetMyUnreadCount / MarkRead / MarkAllRead Api: - NotificationsController: GET /api/notifications + unread-count + mark-read Integration: - ContractWorkflowService emit notification tới Drafter khi HĐ chuyển phase (skip nếu actor chính là Drafter). Title + type theo phase đích: DaPhatHanh → ContractPublished, TuChoi → ContractRejected, khác → ContractPhaseTransition. FE: - Both NotificationBell (admin + user) dùng /api/notifications thật (thay cho derived-from-inbox MVP trước đó). 30s refetch, click mark-read, 'Đọc hết' bulk action. Foundation sẵn cho SignalR push + email outbox sau này — chỉ cần mở rộng NotificationService mà không đổi caller. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
17
src/Backend/SolutionErp.Domain/Notifications/Notification.cs
Normal file
17
src/Backend/SolutionErp.Domain/Notifications/Notification.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using SolutionErp.Domain.Common;
|
||||
|
||||
namespace SolutionErp.Domain.Notifications;
|
||||
|
||||
public class Notification : BaseEntity
|
||||
{
|
||||
public Guid UserId { get; set; }
|
||||
public NotificationType Type { get; set; }
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string? Description { get; set; }
|
||||
public string? Href { get; set; }
|
||||
public DateTime? ReadAt { get; set; }
|
||||
|
||||
// Optional correlation to source entity (contract, user, etc.). Interpretation
|
||||
// depends on Type. Kept nullable to avoid a discriminated-union migration.
|
||||
public Guid? RefId { get; set; }
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
namespace SolutionErp.Domain.Notifications;
|
||||
|
||||
// Stable ints — order matters for persistence + analytics. Don't renumber.
|
||||
public enum NotificationType
|
||||
{
|
||||
ContractPhaseTransition = 1,
|
||||
ContractCommentAdded = 2,
|
||||
SlaWarning = 3,
|
||||
SlaOverdue = 4,
|
||||
ContractPublished = 5,
|
||||
ContractRejected = 6,
|
||||
Generic = 99,
|
||||
}
|
||||
Reference in New Issue
Block a user