source: ChapterX.Infrastructure/Repositories/NotificationRepository.cs@ e882b92

main
Last change on this file since e882b92 was e882b92, checked in by kikisrbinoska <srbinoskakristina07@…>, 13 days ago

Added corrected entitef from the ER diagram and changes for the logic to be coresponding to the ddl

  • Property mode set to 100644
File size: 728 bytes
Line 
1using ChapterX.Domain.Entities;
2using ChapterX.Domain.Repositories;
3using ChapterX.Infrastructure.Data.DataContext;
4using Microsoft.EntityFrameworkCore;
5
6namespace ChapterX.Infrastructure.Repositories
7{
8 public class NotificationRepository : GenericRepository<Notification>, INotificationRepository
9 {
10 public NotificationRepository(ApplicationDbContext context) : base(context)
11 {
12 }
13
14 public async Task<IEnumerable<Notification>> GetByUserIdAsync(int userId, CancellationToken cancellationToken = default)
15 => await _dbSet
16 .Where(n => n.UserId == userId)
17 .OrderByDescending(n => n.CreatedAt)
18 .ToListAsync(cancellationToken);
19 }
20}
Note: See TracBrowser for help on using the repository browser.