Refactored Cache Cleanup code.
This commit is contained in:
parent
0f82b45b9d
commit
e60f795410
2 changed files with 4 additions and 5 deletions
|
@ -177,13 +177,13 @@ namespace API.Controllers
|
|||
var username = User.GetUsername();
|
||||
_logger.LogInformation($"Library {libraryId} is being deleted by {username}.");
|
||||
var series = await _unitOfWork.SeriesRepository.GetSeriesForLibraryIdAsync(libraryId);
|
||||
var volumes = (await _unitOfWork.SeriesRepository.GetVolumesForSeriesAsync(series.Select(x => x.Id).ToArray()))
|
||||
.Select(x => x.Id).ToArray();
|
||||
var chapterIds =
|
||||
await _unitOfWork.SeriesRepository.GetChapterIdsForSeriesAsync(series.Select(x => x.Id).ToArray());
|
||||
var result = await _unitOfWork.LibraryRepository.DeleteLibrary(libraryId);
|
||||
|
||||
if (result && volumes.Any())
|
||||
if (result && chapterIds.Any())
|
||||
{
|
||||
_taskScheduler.CleanupVolumes(volumes);
|
||||
_taskScheduler.CleanupChapters(chapterIds);
|
||||
}
|
||||
|
||||
return Ok(result);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue