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

@ -1,5 +1,4 @@
using System.Collections.Generic;
using API.DTOs;
namespace API.Interfaces
{
@ -7,6 +6,6 @@ namespace API.Interfaces
{
IEnumerable<string> ListDirectory(string rootPath);
void ScanLibrary(LibraryDto library);
void ScanLibrary(int libraryId);
}
}

View file

@ -10,16 +10,10 @@ namespace API.Interfaces
void Update(Library library);
Task<bool> SaveAllAsync();
Task<IEnumerable<LibraryDto>> GetLibrariesAsync();
/// <summary>
/// Checks to see if a library of the same name exists. We only allow unique library names, no duplicates per LibraryType.
/// </summary>
/// <param name="libraryName"></param>
/// <returns></returns>
Task<bool> LibraryExists(string libraryName);
Task<LibraryDto> GetLibraryDtoForIdAsync(int libraryId);
Task<Library> GetLibraryForIdAsync(int libraryId);
bool SaveAll();
Library GetLibraryForName(string libraryName);
Task<IEnumerable<LibraryDto>> GetLibrariesForUsernameAysnc(string userName);
Task<IEnumerable<LibraryDto>> GetLibrariesDtoForUsernameAsync(string userName);
Task<Library> GetLibraryForNameAsync(string libraryName);
}
}

View file

@ -12,11 +12,10 @@ namespace API.Interfaces
Task<Series> GetSeriesByNameAsync(string name);
Series GetSeriesByName(string name);
bool SaveAll();
Task<IEnumerable<SeriesDto>> GetSeriesForLibraryIdAsync(int libraryId);
Task<IEnumerable<VolumeDto>> GetVolumesAsync(int seriesId);
IEnumerable<VolumeDto> GetVolumesDto(int seriesId);
Task<IEnumerable<SeriesDto>> GetSeriesDtoForLibraryIdAsync(int libraryId);
Task<IEnumerable<VolumeDto>> GetVolumesDtoAsync(int seriesId);
IEnumerable<Volume> GetVolumes(int seriesId);
Task<SeriesDto> GetSeriesByIdAsync(int seriesId);
Task<SeriesDto> GetSeriesDtoByIdAsync(int seriesId);
}
}