main
|
Last change
on this file since 7fbb91c was 73b69b2, checked in by kikisrbinoska <srbinoskakristina07@…>, 3 months ago |
|
Fixed reading lists,comments and likes
|
-
Property mode
set to
100644
|
|
File size:
907 bytes
|
| Line | |
|---|
| 1 | using ChapterX.Domain.Entities;
|
|---|
| 2 | using ChapterX.Domain.Repositories;
|
|---|
| 3 | using ChapterX.Infrastructure.Data.DataContext;
|
|---|
| 4 | using Microsoft.EntityFrameworkCore;
|
|---|
| 5 |
|
|---|
| 6 | namespace ChapterX.Infrastructure.Repositories
|
|---|
| 7 | {
|
|---|
| 8 | public class NotificationRepository : GenericRepository<Notification>, INotificationRepository
|
|---|
| 9 | {
|
|---|
| 10 | public NotificationRepository(ApplicationDbContext context) : base(context)
|
|---|
| 11 | {
|
|---|
| 12 | }
|
|---|
| 13 |
|
|---|
| 14 | // Currently Notification is not linked directly to a User entity.
|
|---|
| 15 | // This method returns all notifications; adjust filter when a User relation is added.
|
|---|
| 16 | public async Task<IEnumerable<Notification>> GetByUserIdAsync(int userId, CancellationToken cancellationToken = default)
|
|---|
| 17 | => await _dbSet
|
|---|
| 18 | .Where(n => n.RecipientUserId == userId)
|
|---|
| 19 | .OrderByDescending(n => n.CreatedAt)
|
|---|
| 20 | .ToListAsync(cancellationToken);
|
|---|
| 21 | }
|
|---|
| 22 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.