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

@ -2,7 +2,7 @@
namespace API.Entities
{
/// <summary>
/// Represents the progress a single user has on a given Volume.
/// Represents the progress a single user has on a given Volume. Progress is realistically tracked against the Volume's chapters.
/// </summary>
public class AppUserProgress
{
@ -11,6 +11,8 @@ namespace API.Entities
public int VolumeId { get; set; }
public int SeriesId { get; set; }
public int ChapterId { get; set; }
// Relationships
public AppUser AppUser { get; set; }
public int AppUserId { get; set; }

35
API/Entities/Chapter.cs Normal file
View file

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using API.Entities.Interfaces;
namespace API.Entities
{
public class Chapter : IEntityDate
{
public int Id { get; set; }
/// <summary>
/// Range of numbers. Chapter 2-4 -> "2-4". Chapter 2 -> "2".
/// </summary>
public string Range { get; set; }
/// <summary>
/// Smallest number of the Range. Can be a partial like Chapter 4.5
/// </summary>
public string Number { get; set; }
/// <summary>
/// The files that represent this Chapter
/// </summary>
public ICollection<MangaFile> Files { get; set; }
public DateTime Created { get; set; }
public DateTime LastModified { get; set; }
public byte[] CoverImage { get; set; }
/// <summary>
/// Total number of pages in all MangaFiles
/// </summary>
public int Pages { get; set; }
// Relationships
public Volume Volume { get; set; }
public int VolumeId { get; set; }
}
}

View file

@ -1,10 +1,18 @@

using System;
namespace API.Entities
{
public class FolderPath
{
public int Id { get; set; }
public string Path { get; set; }
/// <summary>
/// Used when scanning to see if we can skip if nothing has changed.
/// </summary>
public DateTime LastScanned { get; set; }
// Relationship
public Library Library { get; set; }
public int LibraryId { get; set; }
}

View file

@ -9,18 +9,14 @@ namespace API.Entities
/// </summary>
public string FilePath { get; set; }
/// <summary>
/// Used to track if multiple MangaFiles (archives) represent a single Volume. If only one volume file, this will be 0.
/// </summary>
public int Chapter { get; set; }
/// <summary>
/// Number of pages for the given file
/// </summary>
public int NumberOfPages { get; set; }
public MangaFormat Format { get; set; }
// Relationship Mapping
public Volume Volume { get; set; }
public int VolumeId { get; set; }
public Chapter Chapter { get; set; }
public int ChapterId { get; set; }
}
}

View file

@ -12,14 +12,14 @@ namespace API.Entities
/// </summary>
public string Name { get; set; }
/// <summary>
/// Original Japanese Name
/// </summary>
public string OriginalName { get; set; }
/// <summary>
/// The name used to sort the Series. By default, will be the same as Name.
/// </summary>
public string SortName { get; set; }
/// <summary>
/// Original Name on disk. Not exposed to UI.
/// </summary>
public string OriginalName { get; set; }
/// <summary>
/// Summary information related to the Series
/// </summary>
public string Summary { get; set; }
@ -30,7 +30,7 @@ namespace API.Entities
/// Sum of all Volume page counts
/// </summary>
public int Pages { get; set; }
// Relationships
public ICollection<Volume> Volumes { get; set; }
public Library Library { get; set; }

View file

@ -9,11 +9,16 @@ namespace API.Entities
public int Id { get; set; }
public string Name { get; set; }
public int Number { get; set; }
public ICollection<MangaFile> Files { get; set; }
public ICollection<Chapter> Chapters { get; set; }
public DateTime Created { get; set; }
public DateTime LastModified { get; set; }
public byte[] CoverImage { get; set; }
public int Pages { get; set; }
/// <summary>
/// Represents a Side story that is linked to the original Series. Omake, One Shot, etc.
/// </summary>
public bool IsSpecial { get; set; } = false;