Removed some dead code on the interfaces. Introduced UnitOfWork to simplify repo injection.

This commit is contained in:
Joseph Milazzo 2021-01-18 13:07:48 -06:00
parent 4a2296a18a
commit 825afd83a2
23 changed files with 165 additions and 204 deletions

View file

@ -13,13 +13,8 @@ namespace API.Interfaces
/// <returns>List of folder names</returns>
IEnumerable<string> ListDirectory(string rootPath);
/// <summary>
/// Lists out top-level files for a given directory.
/// TODO: Implement ability to provide a filter for file types (done in another implementation on DirectoryService)
/// </summary>
/// <param name="rootPath">Absolute path </param>
/// <returns>List of folder names</returns>
IList<string> ListFiles(string rootPath);
//IList<string> ListFiles(string rootPath);
/// <summary>
/// Given a library id, scans folders for said library. Parses files and generates DB updates. Will overwrite

View file

@ -8,7 +8,6 @@ namespace API.Interfaces
public interface ILibraryRepository
{
void Update(Library library);
Task<bool> SaveAllAsync();
Task<IEnumerable<LibraryDto>> GetLibrariesAsync();
Task<bool> LibraryExists(string libraryName);
Task<Library> GetLibraryForIdAsync(int libraryId);

View file

@ -8,17 +8,15 @@ namespace API.Interfaces
public interface ISeriesRepository
{
void Update(Series series);
Task<bool> SaveAllAsync();
Task<Series> GetSeriesByNameAsync(string name);
Series GetSeriesByName(string name);
bool SaveAll();
Task<IEnumerable<SeriesDto>> GetSeriesDtoForLibraryIdAsync(int libraryId, int userId = 0);
Task<IEnumerable<VolumeDto>> GetVolumesDtoAsync(int seriesId, int userId = 0);
IEnumerable<Volume> GetVolumes(int seriesId);
Task<SeriesDto> GetSeriesDtoByIdAsync(int seriesId);
Task<Volume> GetVolumeAsync(int volumeId);
Task<VolumeDto> GetVolumeDtoAsync(int volumeId); // TODO: Likely need to update here
Task<VolumeDto> GetVolumeDtoAsync(int volumeId);
Task<IEnumerable<Volume>> GetVolumesForSeriesAsync(int[] seriesIds);
Task<bool> DeleteSeriesAsync(int seriesId);

View file

@ -0,0 +1,13 @@
using System.Threading.Tasks;
namespace API.Interfaces
{
public interface IUnitOfWork
{
ISeriesRepository SeriesRepository { get; }
IUserRepository UserRepository { get; }
ILibraryRepository LibraryRepository { get; }
Task<bool> Complete();
bool HasChanges();
}
}

View file

@ -8,12 +8,8 @@ namespace API.Interfaces
public interface IUserRepository
{
void Update(AppUser user);
Task<bool> SaveAllAsync();
Task<IEnumerable<AppUser>> GetUsersAsync();
Task<AppUser> GetUserByIdAsync(int id);
Task<AppUser> GetUserByUsernameAsync(string username);
Task<IEnumerable<MemberDto>> GetMembersAsync();
Task<MemberDto> GetMemberAsync(string username);
public void Delete(AppUser user);
Task<IEnumerable<AppUser>> GetAdminUsersAsync();
}