Refactored ScanLibrary to accept and library id rather than DTO. Refactored ScanLibrary to use Task.Run() rather than having synchronous repo methods.

This commit is contained in:
Joseph Milazzo 2021-01-02 12:48:48 -06:00
parent 9168e12483
commit 7b1714349d
9 changed files with 44 additions and 75 deletions

View file

@ -46,7 +46,7 @@ namespace API.Data
return _context.Series.SingleOrDefault(x => x.Name == name);
}
public async Task<IEnumerable<SeriesDto>> GetSeriesForLibraryIdAsync(int libraryId)
public async Task<IEnumerable<SeriesDto>> GetSeriesDtoForLibraryIdAsync(int libraryId)
{
return await _context.Series
.Where(series => series.LibraryId == libraryId)
@ -54,22 +54,14 @@ namespace API.Data
.ProjectTo<SeriesDto>(_mapper.ConfigurationProvider).ToListAsync();
}
public async Task<IEnumerable<VolumeDto>> GetVolumesAsync(int seriesId)
public async Task<IEnumerable<VolumeDto>> GetVolumesDtoAsync(int seriesId)
{
return await _context.Volume
.Where(vol => vol.SeriesId == seriesId)
.OrderBy(volume => volume.Number)
.ProjectTo<VolumeDto>(_mapper.ConfigurationProvider).ToListAsync();
}
public IEnumerable<VolumeDto> GetVolumesDto(int seriesId)
{
return _context.Volume
.Where(vol => vol.SeriesId == seriesId)
.OrderBy(vol => vol.Number)
.ProjectTo<VolumeDto>(_mapper.ConfigurationProvider).ToList();
}
public IEnumerable<Volume> GetVolumes(int seriesId)
{
return _context.Volume
@ -78,7 +70,7 @@ namespace API.Data
.ToList();
}
public async Task<SeriesDto> GetSeriesByIdAsync(int seriesId)
public async Task<SeriesDto> GetSeriesDtoByIdAsync(int seriesId)
{
return await _context.Series.Where(x => x.Id == seriesId)
.ProjectTo<SeriesDto>(_mapper.ConfigurationProvider).SingleAsync();