Stats V3 (#3443)
This commit is contained in:
parent
bcfb4a6172
commit
b24b8686f3
13 changed files with 510 additions and 347 deletions
|
|
@ -39,7 +39,7 @@ public interface ILibraryRepository
|
|||
Task<bool> LibraryExists(string libraryName);
|
||||
Task<Library?> GetLibraryForIdAsync(int libraryId, LibraryIncludes includes = LibraryIncludes.None);
|
||||
IEnumerable<LibraryDto> GetLibraryDtosForUsernameAsync(string userName);
|
||||
Task<IEnumerable<Library>> GetLibrariesAsync(LibraryIncludes includes = LibraryIncludes.None);
|
||||
Task<IEnumerable<Library>> GetLibrariesAsync(LibraryIncludes includes = LibraryIncludes.None, bool track = true);
|
||||
Task<IEnumerable<Library>> GetLibrariesForUserIdAsync(int userId);
|
||||
IEnumerable<int> GetLibraryIdsForUserIdAsync(int userId, QueryContext queryContext = QueryContext.None);
|
||||
Task<LibraryType> GetLibraryTypeAsync(int libraryId);
|
||||
|
|
@ -104,13 +104,16 @@ public class LibraryRepository : ILibraryRepository
|
|||
/// </summary>
|
||||
/// <param name="includes"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IEnumerable<Library>> GetLibrariesAsync(LibraryIncludes includes = LibraryIncludes.None)
|
||||
public async Task<IEnumerable<Library>> GetLibrariesAsync(LibraryIncludes includes = LibraryIncludes.None, bool track = true)
|
||||
{
|
||||
return await _context.Library
|
||||
var query = _context.Library
|
||||
.Include(l => l.AppUsers)
|
||||
.Includes(includes)
|
||||
.AsSplitQuery()
|
||||
.ToListAsync();
|
||||
.AsSplitQuery();
|
||||
|
||||
if (track) return await query.ToListAsync();
|
||||
|
||||
return await query.AsNoTracking().ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ public interface ISeriesRepository
|
|||
Task ClearOnDeckRemoval(int seriesId, int userId);
|
||||
Task<PagedList<SeriesDto>> GetSeriesDtoForLibraryIdV2Async(int userId, UserParams userParams, FilterV2Dto filterDto, QueryContext queryContext = QueryContext.None);
|
||||
Task<PlusSeriesDto?> GetPlusSeriesDto(int seriesId);
|
||||
Task<int> GetCountAsync();
|
||||
}
|
||||
|
||||
public class SeriesRepository : ISeriesRepository
|
||||
|
|
@ -726,6 +727,10 @@ public class SeriesRepository : ISeriesRepository
|
|||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<int> GetCountAsync()
|
||||
{
|
||||
return await _context.Series.CountAsync();
|
||||
}
|
||||
|
||||
public async Task AddSeriesModifiers(int userId, IList<SeriesDto> series)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public interface IUserRepository
|
|||
Task<IEnumerable<AppUserPreferences>> GetAllPreferencesByThemeAsync(int themeId);
|
||||
Task<bool> HasAccessToLibrary(int libraryId, int userId);
|
||||
Task<bool> HasAccessToSeries(int userId, int seriesId);
|
||||
Task<IEnumerable<AppUser>> GetAllUsersAsync(AppUserIncludes includeFlags = AppUserIncludes.None);
|
||||
Task<IEnumerable<AppUser>> GetAllUsersAsync(AppUserIncludes includeFlags = AppUserIncludes.None, bool track = true);
|
||||
Task<AppUser?> GetUserByConfirmationToken(string token);
|
||||
Task<AppUser> GetDefaultAdminUser(AppUserIncludes includes = AppUserIncludes.None);
|
||||
Task<IEnumerable<AppUserRating>> GetSeriesWithRatings(int userId);
|
||||
|
|
@ -283,10 +283,17 @@ public class UserRepository : IUserRepository
|
|||
.AnyAsync(s => s.Id == seriesId);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<AppUser>> GetAllUsersAsync(AppUserIncludes includeFlags = AppUserIncludes.None)
|
||||
public async Task<IEnumerable<AppUser>> GetAllUsersAsync(AppUserIncludes includeFlags = AppUserIncludes.None, bool track = true)
|
||||
{
|
||||
return await _context.AppUser
|
||||
.Includes(includeFlags)
|
||||
var query = _context.AppUser
|
||||
.Includes(includeFlags);
|
||||
if (track)
|
||||
{
|
||||
return await query.ToListAsync();
|
||||
}
|
||||
|
||||
return await query
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue