Performance Improvements (#2449)

This commit is contained in:
Joe Milazzo 2023-11-21 13:20:36 -06:00 committed by GitHub
parent 419a827d42
commit 5ed1eebd26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 389 additions and 132 deletions

View file

@ -17,6 +17,7 @@ public interface IGenreRepository
void Remove(Genre genre);
Task<Genre?> FindByNameAsync(string genreName);
Task<IList<Genre>> GetAllGenresAsync();
Task<IList<Genre>> GetAllGenresByNamesAsync(IEnumerable<string> normalizedNames);
Task<IList<GenreTagDto>> GetAllGenreDtosAsync(int userId);
Task RemoveAllGenreNoLongerAssociated(bool removeExternal = false);
Task<IList<GenreTagDto>> GetAllGenreDtosForLibrariesAsync(IList<int> libraryIds, int userId);
@ -96,6 +97,13 @@ public class GenreRepository : IGenreRepository
return await _context.Genre.ToListAsync();
}
public async Task<IList<Genre>> GetAllGenresByNamesAsync(IEnumerable<string> normalizedNames)
{
return await _context.Genre
.Where(g => normalizedNames.Contains(g.NormalizedTitle))
.ToListAsync();
}
public async Task<IList<GenreTagDto>> GetAllGenreDtosAsync(int userId)
{
var ageRating = await _context.AppUser.GetUserAgeRestriction(userId);