Interface INotificationService
- Namespace
- Builvero.Application.Services
- Assembly
- Builvero.Application.dll
Defines the contract for user notification management operations.
public interface INotificationService
Remarks
This interface provides methods for retrieving notifications, getting summary statistics, and managing read/unread status. All operations are user-scoped - users can only access their own notifications.
Methods
GetNotificationsAsync(Guid, CancellationToken)
Retrieves all unread notifications for a user.
Task<List<NotificationDto>> GetNotificationsAsync(Guid userId, CancellationToken cancellationToken = default)
Parameters
userIdGuidThe unique identifier of the user whose notifications should be retrieved.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<List<NotificationDto>>
A list of NotificationDto objects representing unread notifications.
GetSummaryAsync(Guid, CancellationToken)
Retrieves a summary of notifications for a user, including unread counts by notification type.
Task<NotificationSummaryDto> GetSummaryAsync(Guid userId, CancellationToken cancellationToken = default)
Parameters
userIdGuidThe unique identifier of the user whose notification summary should be retrieved.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<NotificationSummaryDto>
A NotificationSummaryDto containing unread counts by notification type.
MarkAllAsReadAsync(Guid, CancellationToken)
Marks all unread notifications as read for a user.
Task MarkAllAsReadAsync(Guid userId, CancellationToken cancellationToken = default)
Parameters
userIdGuidThe unique identifier of the user whose notifications should be marked as read.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task
- Defines the contract for user notification management operations.
MarkAsReadAsync(Guid, Guid, CancellationToken)
Marks a specific notification as read for a user.
Task MarkAsReadAsync(Guid notificationId, Guid userId, CancellationToken cancellationToken = default)
Parameters
notificationIdGuidThe unique identifier of the notification to mark as read.
userIdGuidThe unique identifier of the user marking the notification as read.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task
- Defines the contract for user notification management operations.
Exceptions
- Exception
Thrown when the notification is not found.
- UnauthorizedAccessException
Thrown when the user attempts to mark a notification that doesn't belong to them.