Hooked up average rating for the issue, external ratings for individual issues (cbr only), and some polish.

Show Issues not Chapters for CBR matches.
This commit is contained in:
Joseph Milazzo 2025-04-29 10:05:01 -05:00
parent 6d4dfcda67
commit da99c97813
21 changed files with 231 additions and 40 deletions

View file

@ -52,6 +52,7 @@ public interface IChapterRepository
Task<IList<Chapter>> GetAllChaptersForSeries(int seriesId);
Task<int> GetAverageUserRating(int chapterId, int userId);
Task<IList<UserReviewDto>> GetExternalChapterReviews(int chapterId);
Task<IList<RatingDto>> GetExternalChapterRatings(int chapterId);
}
public class ChapterRepository : IChapterRepository
{
@ -340,4 +341,13 @@ public class ChapterRepository : IChapterRepository
.Select(r => _mapper.Map<UserReviewDto>(r))
.ToListAsync();
}
public async Task<IList<RatingDto>> GetExternalChapterRatings(int chapterId)
{
return await _context.Chapter
.Where(c => c.Id == chapterId)
.SelectMany(c => c.ExternalRatings)
.ProjectTo<RatingDto>(_mapper.ConfigurationProvider)
.ToListAsync();
}
}