-
Notifications
You must be signed in to change notification settings - Fork 0
UX-25: Notification type differentiation, grouping, and batch actions #646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c2a5f78
2a9666f
2c527a8
dce1014
e67ffcf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,4 +49,20 @@ public async Task<IEnumerable<Notification>> GetByUserIdAsync( | |
| n => n.UserId == userId && n.DeduplicationKey == deduplicationKey, | ||
| cancellationToken); | ||
| } | ||
|
|
||
| public async Task<IEnumerable<Notification>> GetUnreadByUserIdAsync( | ||
| Guid userId, | ||
| Guid? boardId = null, | ||
| CancellationToken cancellationToken = default) | ||
| { | ||
| var query = _dbSet | ||
| .Where(n => n.UserId == userId && !n.IsRead); | ||
|
|
||
| if (boardId.HasValue) | ||
| { | ||
| query = query.Where(n => n.BoardId == boardId.Value); | ||
| } | ||
|
|
||
| return await query.ToListAsync(cancellationToken); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fetching all unread notifications without a limit can be dangerous for performance if a user has accumulated a very large number of notifications. Since this method is primarily used for batch updates, consider if a bulk update approach would be more appropriate, or at least apply a reasonable maximum limit to the query. |
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation of
MarkAllAsReadAsyncfetches all unread notifications into memory and iterates over them to update each one individually. For users with a large volume of unread notifications, this can lead to significant memory pressure and performance issues. Consider implementing a bulk update operation in the repository (e.g., using EF Core'sExecuteUpdateAsync) to perform this change directly in the database.