Interface IForumRepository
- Namespace
- Builvero.Application.Interfaces.Repositories
- Assembly
- Builvero.Application.dll
Defines the contract for forum data access operations including topics, messages, subscriptions, and notification settings.
public interface IForumRepository
Remarks
This repository interface provides methods for managing forum entities including topics, messages, notification settings, and topic subscriptions. It supports soft-delete functionality where deleted content is marked but not permanently removed from the database.
Methods
CreateMessageAsync(ProjectForumMessage, CancellationToken)
Creates a new forum message entity in the database.
Task<ProjectForumMessage> CreateMessageAsync(ProjectForumMessage message, CancellationToken cancellationToken = default)
Parameters
messageProjectForumMessageThe forum message entity to create.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<ProjectForumMessage>
The created forum message entity with generated ID and timestamps.
CreateOrUpdateNotificationSettingsAsync(ProjectForumNotificationSettings, CancellationToken)
Creates or updates the forum notification settings for a user in a specific project.
Task<ProjectForumNotificationSettings> CreateOrUpdateNotificationSettingsAsync(ProjectForumNotificationSettings settings, CancellationToken cancellationToken = default)
Parameters
settingsProjectForumNotificationSettingsThe notification settings entity to create or update.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<ProjectForumNotificationSettings>
The created or updated notification settings entity.
Remarks
If settings already exist for the user and project, they are updated; otherwise, new settings are created.
CreateOrUpdateTopicSubscriptionAsync(ProjectForumTopicSubscription, CancellationToken)
Creates or updates the topic subscription for a user in a specific topic.
Task<ProjectForumTopicSubscription> CreateOrUpdateTopicSubscriptionAsync(ProjectForumTopicSubscription subscription, CancellationToken cancellationToken = default)
Parameters
subscriptionProjectForumTopicSubscriptionThe topic subscription entity to create or update.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<ProjectForumTopicSubscription>
The created or updated topic subscription entity.
Remarks
If a subscription already exists for the user and topic, it is updated; otherwise, a new subscription is created.
CreateTopicAsync(ProjectForumTopic, CancellationToken)
Creates a new forum topic entity in the database.
Task<ProjectForumTopic> CreateTopicAsync(ProjectForumTopic topic, CancellationToken cancellationToken = default)
Parameters
topicProjectForumTopicThe forum topic entity to create.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<ProjectForumTopic>
The created forum topic entity with generated ID and timestamps.
GetMessageByIdAsync(Guid, CancellationToken)
Retrieves a forum message by its unique identifier.
Task<ProjectForumMessage?> GetMessageByIdAsync(Guid messageId, CancellationToken cancellationToken = default)
Parameters
messageIdGuidThe unique identifier of the message to retrieve.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<ProjectForumMessage>
The forum message entity if found; otherwise, null.
GetMessagesByTopicIdAsync(Guid, bool, CancellationToken)
Retrieves all forum messages for a specific topic, optionally including soft-deleted messages.
Task<List<ProjectForumMessage>> GetMessagesByTopicIdAsync(Guid topicId, bool includeDeleted, CancellationToken cancellationToken = default)
Parameters
topicIdGuidThe unique identifier of the topic.
includeDeletedboolWhether to include soft-deleted messages in the results.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<List<ProjectForumMessage>>
A list of forum messages for the topic.
GetNotificationSettingsAsync(Guid, Guid, CancellationToken)
Retrieves the forum notification settings for a user in a specific project.
Task<ProjectForumNotificationSettings?> GetNotificationSettingsAsync(Guid projectId, Guid userId, CancellationToken cancellationToken = default)
Parameters
projectIdGuidThe unique identifier of the project.
userIdGuidThe unique identifier of the user.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<ProjectForumNotificationSettings>
The notification settings entity if found; otherwise, null.
GetSubscriptionsByTopicIdAsync(Guid, CancellationToken)
Retrieves all topic subscriptions for a specific topic (used for sending email notifications).
Task<List<ProjectForumTopicSubscription>> GetSubscriptionsByTopicIdAsync(Guid topicId, CancellationToken cancellationToken = default)
Parameters
topicIdGuidThe unique identifier of the topic.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<List<ProjectForumTopicSubscription>>
A list of topic subscriptions for the topic.
GetTopicByIdAsync(Guid, CancellationToken)
Retrieves a forum topic by its unique identifier.
Task<ProjectForumTopic?> GetTopicByIdAsync(Guid topicId, CancellationToken cancellationToken = default)
Parameters
topicIdGuidThe unique identifier of the topic to retrieve.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<ProjectForumTopic>
The forum topic entity if found; otherwise, null.
GetTopicSubscriptionAsync(Guid, Guid, CancellationToken)
Retrieves the topic subscription for a user in a specific topic.
Task<ProjectForumTopicSubscription?> GetTopicSubscriptionAsync(Guid topicId, Guid userId, CancellationToken cancellationToken = default)
Parameters
topicIdGuidThe unique identifier of the topic.
userIdGuidThe unique identifier of the user.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<ProjectForumTopicSubscription>
The topic subscription entity if found; otherwise, null.
GetTopicsByProjectIdAsync(Guid, bool, CancellationToken)
Retrieves all forum topics for a specific project, optionally including soft-deleted topics.
Task<List<ProjectForumTopic>> GetTopicsByProjectIdAsync(Guid projectId, bool includeDeleted, CancellationToken cancellationToken = default)
Parameters
projectIdGuidThe unique identifier of the project.
includeDeletedboolWhether to include soft-deleted topics in the results.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<List<ProjectForumTopic>>
A list of forum topics for the project.
UpdateMessageAsync(ProjectForumMessage, CancellationToken)
Updates an existing forum message entity in the database.
Task<ProjectForumMessage> UpdateMessageAsync(ProjectForumMessage message, CancellationToken cancellationToken = default)
Parameters
messageProjectForumMessageThe forum message entity with updated values.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<ProjectForumMessage>
The updated forum message entity.
UpdateTopicAsync(ProjectForumTopic, CancellationToken)
Updates an existing forum topic entity in the database.
Task<ProjectForumTopic> UpdateTopicAsync(ProjectForumTopic topic, CancellationToken cancellationToken = default)
Parameters
topicProjectForumTopicThe forum topic entity with updated values.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<ProjectForumTopic>
The updated forum topic entity.