Changeset acf690c for ChapterX.Infrastructure/Repositories
- Timestamp:
- 03/22/26 17:58:40 (4 months ago)
- Branches:
- main
- Children:
- 73b69b2
- Parents:
- b62cefc
- Location:
- ChapterX.Infrastructure/Repositories
- Files:
-
- 4 edited
-
GenericRepository.cs (modified) (1 diff)
-
ReadingListItemsRepository.cs (modified) (2 diffs)
-
ReadingListRepository.cs (modified) (1 diff)
-
UserRepository.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ChapterX.Infrastructure/Repositories/GenericRepository.cs
rb62cefc racf690c 21 21 => await _dbSet.FindAsync([id], cancellationToken); 22 22 23 public async Task<IEnumerable<T>> GetAllAsync(CancellationToken cancellationToken = default)23 public virtual async Task<IEnumerable<T>> GetAllAsync(CancellationToken cancellationToken = default) 24 24 => await _dbSet.ToListAsync(cancellationToken); 25 25 -
ChapterX.Infrastructure/Repositories/ReadingListItemsRepository.cs
rb62cefc racf690c 2 2 using ChapterX.Domain.Repositories; 3 3 using ChapterX.Infrastructure.Data.DataContext; 4 using System; 5 using System.Collections.Generic; 6 using System.Linq; 7 using System.Text; 8 using System.Threading.Tasks; 4 using Microsoft.EntityFrameworkCore; 9 5 10 6 namespace ChapterX.Infrastructure.Repositories … … 15 11 { 16 12 } 13 14 public async Task<bool> ExistsAsync(int listId, int storyId, CancellationToken cancellationToken = default) 15 => await _dbSet.AnyAsync(i => i.ListId == listId && i.StoryId == storyId, cancellationToken); 17 16 } 18 17 } -
ChapterX.Infrastructure/Repositories/ReadingListRepository.cs
rb62cefc racf690c 12 12 } 13 13 14 public override async Task<IEnumerable<ReadingList>> GetAllAsync(CancellationToken cancellationToken = default) 15 { 16 return await _dbSet 17 .Include(r => r.ReadingListItems) 18 .ToListAsync(cancellationToken); 19 } 20 14 21 public async Task<IEnumerable<ReadingList>> GetByUserIdAsync(int userId, CancellationToken cancellationToken = default) 15 22 { 16 23 return await _dbSet 17 24 .Where(r => r.UserId == userId) 25 .Include(r => r.ReadingListItems) 18 26 .ToListAsync(cancellationToken); 19 27 } -
ChapterX.Infrastructure/Repositories/UserRepository.cs
rb62cefc racf690c 13 13 14 14 public async Task<User?> GetByEmailAsync(string email, CancellationToken cancellationToken = default) 15 => await _dbSet.FirstOrDefaultAsync(u => u.Email == email, cancellationToken); 15 => await _dbSet 16 .Include(u => u.Admin) 17 .Include(u => u.Writer) 18 .Include(u => u.RegularUser) 19 .FirstOrDefaultAsync(u => u.Email == email, cancellationToken); 16 20 17 21 public async Task<User?> GetByUsernameAsync(string username, CancellationToken cancellationToken = default)
Note:
See TracChangeset
for help on using the changeset viewer.
