Refactored DB to be Series->Volumes->Chapters instead. All functionality that previously worked still works. Cleanup still needed.

This commit is contained in:
Joseph Milazzo 2021-02-01 09:29:11 -06:00
parent a42e54a078
commit 53e85317f9
33 changed files with 2084 additions and 142 deletions

View file

@ -6,12 +6,12 @@ namespace API.Interfaces
public interface ICacheService
{
/// <summary>
/// Ensures the cache is created for the given volume and if not, will create it. Should be called before any other
/// Ensures the cache is created for the given chapter and if not, will create it. Should be called before any other
/// cache operations (except cleanup).
/// </summary>
/// <param name="volumeId"></param>
/// <returns>Volume for the passed volumeId. Side-effect from ensuring cache.</returns>
Task<Volume> Ensure(int volumeId);
/// <param name="chapterId"></param>
/// <returns>Chapter for the passed chapterId. Side-effect from ensuring cache.</returns>
Task<Chapter> Ensure(int chapterId);
/// <summary>
/// Clears cache directory of all folders and files.
@ -28,11 +28,11 @@ namespace API.Interfaces
/// <summary>
/// Returns the absolute path of a cached page.
/// </summary>
/// <param name="volume"></param>
/// <param name="chapter">Chapter entity with Files populated.</param>
/// <param name="page">Page number to look for</param>
/// <returns></returns>
(string path, MangaFile file) GetCachedPagePath(Volume volume, int page);
Task<(string path, MangaFile file)> GetCachedPagePath(Chapter chapter, int page);
bool CacheDirectoryIsAccessible();
void EnsureCacheDirectory();
}
}

View file

@ -7,6 +7,7 @@ namespace API.Interfaces
ISeriesRepository SeriesRepository { get; }
IUserRepository UserRepository { get; }
ILibraryRepository LibraryRepository { get; }
IVolumeRepository VolumeRepository { get; }
Task<bool> Complete();
bool HasChanges();
}

View file

@ -0,0 +1,15 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using API.DTOs;
using API.Entities;
namespace API.Interfaces
{
public interface IVolumeRepository
{
void Update(Volume volume);
Task<Chapter> GetChapterAsync(int chapterId);
Task<ChapterDto> GetChapterDtoAsync(int chapterId);
Task<IList<MangaFile>> GetFilesForChapter(int chapterId);
}
}