30 lines
2.0 KiB
C#
30 lines
2.0 KiB
C#
namespace Distribution.Features.Notifications;
|
|
|
|
public interface INotificationRepository
|
|
{
|
|
// ── Inbox ────────────────────────────────────────────────────────────
|
|
Task AddAsync(Models.Notification notification);
|
|
/// <summary>Stops tracking a notification (and its recipients) whose save failed.</summary>
|
|
void Discard(Models.Notification notification);
|
|
|
|
Task<int> GetInboxCountAsync(Guid userId, bool unreadOnly);
|
|
Task<List<Models.NotificationRecipient>> GetInboxAsync(Guid userId, bool unreadOnly, int page, int pageSize);
|
|
Task<int> GetUnreadCountAsync(Guid userId);
|
|
Task<Models.NotificationRecipient?> GetRecipientAsync(Guid userId, Guid recipientId);
|
|
Task<List<Models.NotificationRecipient>> GetUnreadRecipientsAsync(Guid userId);
|
|
void RemoveRecipient(Models.NotificationRecipient recipient);
|
|
|
|
// ── Recipient resolution ─────────────────────────────────────────────
|
|
Task<List<Guid>> FilterActiveUserIdsAsync(IEnumerable<Guid> userIds);
|
|
Task<List<Guid>> GetUserIdsByPermissionAsync(string permissionCode);
|
|
Task<List<Guid>> GetUserIdsByScopeAsync(ScopeKind kind, Guid id);
|
|
Task<Guid?> GetReportsToUserIdAsync(Guid userId);
|
|
Task<Guid?> GetRouteOwnerUserIdAsync(ScopeKind kind, Guid id);
|
|
|
|
// ── Retention ────────────────────────────────────────────────────────
|
|
Task<List<Models.NotificationRecipient>> GetExpiredReadRecipientsAsync(DateTime cutoff, int take);
|
|
Task<List<Models.Notification>> GetOrphanNotificationsAsync(int take);
|
|
void RemoveRecipients(IEnumerable<Models.NotificationRecipient> recipients);
|
|
void RemoveNotifications(IEnumerable<Models.Notification> notifications);
|
|
}
|