Implemented ability to delete a series. Refactored some operations to remove unneeded parameters.

This commit is contained in:
Joseph Milazzo 2021-01-12 16:51:23 -06:00
parent 83076f02ad
commit 56e8a0059e
9 changed files with 50 additions and 16 deletions

View file

@ -159,13 +159,13 @@ namespace API.Controllers
var username = User.GetUsername();
_logger.LogInformation($"Library {libraryId} is being deleted by {username}.");
var series = await _seriesRepository.GetSeriesDtoForLibraryIdAsync(libraryId);
var volumes = (await _seriesRepository.GetVolumesForSeriesAsync(series.Select(x => x.Id).ToArray())).ToList();
var volumes = (await _seriesRepository.GetVolumesForSeriesAsync(series.Select(x => x.Id).ToArray()))
.Select(x => x.Id).ToArray();
var result = await _libraryRepository.DeleteLibrary(libraryId);
if (result && volumes.Any())
{
BackgroundJob.Enqueue(() => _cacheService.CleanupLibrary(libraryId, volumes.Select(x => x.Id).ToArray()));
BackgroundJob.Enqueue(() => _cacheService.CleanupVolumes(volumes));
}
return Ok(result);