Table of Contents

Interface IUserNotificationRepository

Namespace
Builvero.Application.Interfaces.Repositories
Assembly
Builvero.Application.dll

Defines the contract for user notification data access operations including creation, retrieval, updates, and bulk operations.

public interface IUserNotificationRepository

Remarks

This repository interface provides methods for managing user notification entities. Notifications inform users about important events such as project invitations, join requests, and their outcomes. All operations are user-scoped - users can only access their own notifications.

Methods

CreateAsync(UserNotification, CancellationToken)

Creates a new user notification entity in the database.

Task<UserNotification> CreateAsync(UserNotification notification, CancellationToken cancellationToken = default)

Parameters

notification UserNotification

The user notification entity to create.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<UserNotification>

The created user notification entity with generated ID and timestamps.

GetByIdAsync(Guid, CancellationToken)

Retrieves a user notification by its unique identifier.

Task<UserNotification?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default)

Parameters

id Guid

The unique identifier of the notification to retrieve.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<UserNotification>

The user notification entity if found; otherwise, null.

GetNotificationSummaryAsync(Guid, CancellationToken)

Retrieves a summary of notifications for a user, including unread counts by notification type.

Task<NotificationSummaryDto> GetNotificationSummaryAsync(Guid userId, CancellationToken cancellationToken = default)

Parameters

userId Guid

The unique identifier of the user.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<NotificationSummaryDto>

A notification summary DTO containing total unread count and counts by type.

GetUnreadNotificationsAsync(Guid, CancellationToken)

Retrieves all unread notifications for a specific user.

Task<List<UserNotification>> GetUnreadNotificationsAsync(Guid userId, CancellationToken cancellationToken = default)

Parameters

userId Guid

The unique identifier of the user.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<List<UserNotification>>

A list of unread notifications for the user, ordered by creation date (newest first).

MarkAllAsReadAsync(Guid, CancellationToken)

Marks all notifications for a specific user as read.

Task MarkAllAsReadAsync(Guid userId, CancellationToken cancellationToken = default)

Parameters

userId Guid

The unique identifier of the user.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task

A task representing the asynchronous operation.

UpdateAsync(UserNotification, CancellationToken)

Updates an existing user notification entity in the database.

Task UpdateAsync(UserNotification notification, CancellationToken cancellationToken = default)

Parameters

notification UserNotification

The user notification entity with updated values.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task

A task representing the asynchronous operation.