Ignore:
Timestamp:
03/22/26 17:58:40 (4 months ago)
Author:
kikisrbinoska <srbinoskakristina07@…>
Branches:
main
Children:
73b69b2
Parents:
b62cefc
Message:

Added fixes for the login,stories management and reading lists

Location:
ChapterX.Infrastructure/Repositories
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ChapterX.Infrastructure/Repositories/GenericRepository.cs

    rb62cefc racf690c  
    2121            => await _dbSet.FindAsync([id], cancellationToken);
    2222
    23         public async Task<IEnumerable<T>> GetAllAsync(CancellationToken cancellationToken = default)
     23        public virtual async Task<IEnumerable<T>> GetAllAsync(CancellationToken cancellationToken = default)
    2424            => await _dbSet.ToListAsync(cancellationToken);
    2525
  • ChapterX.Infrastructure/Repositories/ReadingListItemsRepository.cs

    rb62cefc racf690c  
    22using ChapterX.Domain.Repositories;
    33using 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;
     4using Microsoft.EntityFrameworkCore;
    95
    106namespace ChapterX.Infrastructure.Repositories
     
    1511        {
    1612        }
     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);
    1716    }
    1817}
  • ChapterX.Infrastructure/Repositories/ReadingListRepository.cs

    rb62cefc racf690c  
    1212        }
    1313
     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
    1421        public async Task<IEnumerable<ReadingList>> GetByUserIdAsync(int userId, CancellationToken cancellationToken = default)
    1522        {
    1623            return await _dbSet
    1724                .Where(r => r.UserId == userId)
     25                .Include(r => r.ReadingListItems)
    1826                .ToListAsync(cancellationToken);
    1927        }
  • ChapterX.Infrastructure/Repositories/UserRepository.cs

    rb62cefc racf690c  
    1313
    1414        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);
    1620
    1721        public async Task<User?> GetByUsernameAsync(string username, CancellationToken cancellationToken = default)
Note: See TracChangeset for help on using the changeset viewer.