Reading List Fixes (#1784)
* Add ability to save readinglist comicinfo fields in Chapter. * Added the appropriate fields and migration for Reading List generation. * Started the reading list code * Started building out the CBL import code with some initial unit tests. * Fixed first unit test * Started refactoring control code into services and writing unit tests for ReadingLists. Found a logic issue around reading list title between create/update. Will be corrected in this branch with unit tests. * Can't figure out how to mock UserManager, so had to uncomment a few tests. * Tooltip for total pages read shows the full number * Tweaked the math a bit for average reading per week. * Fixed up the reading list unit tests. Fixed an issue where when inserting chapters into a blank reading list, the initial reading list item would have an order of 1 instead of 0. * Cleaned up the code to allow the reading list code to be localized easily and fixed up a bug in last PR. * Fixed a sorting issue on reading activity * Tweaked the code around reading list actionables not showing due to some weird filter. * Fixed edit library settings not opening on library detail page * Fixed a bug where reading activity dates would be out of order due to a bug in how charts works. A temp hack has been added. * Disable promotion in edit reading list modal since non-admins can (and should have) been able to use it. * Fixed a bug where non-admins couldn't update their OWN reading lists. Made uploading a cover image for readinglists now check against the user's reading list access to allow non-admin's to set images. * Fixed an issue introduced earlier in PR where adding chapters to reading list could cause order to get skewed. * Fixed another regression from earlier commit * Hooked in Import CBL flow. No functionality yet. * Code is a mess. Shifting how the whole import process is going to be done. Commiting so I can pivot drastically. * Very rough code for first step is done. * Ui has started, I've run out of steam for this feature. * Cleaned up the UI code a bit to make the step tracker nature easier without a dedicated component. * Much flow implementation and tweaking to how validation checks and what is sent back. * Removed import via cbl code as it's not done. Pushing to next release.
This commit is contained in:
parent
ae1af22af1
commit
3f24dc7392
48 changed files with 21951 additions and 170 deletions
104
API/DTOs/ReadingLists/CBL/CblImportSummary.cs
Normal file
104
API/DTOs/ReadingLists/CBL/CblImportSummary.cs
Normal file
|
@ -0,0 +1,104 @@
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using API.DTOs.ReadingLists.CBL;
|
||||
|
||||
namespace API.DTOs.ReadingLists;
|
||||
|
||||
public enum CblImportResult {
|
||||
/// <summary>
|
||||
/// There was an issue which prevented processing
|
||||
/// </summary>
|
||||
[Description("Fail")]
|
||||
Fail = 0,
|
||||
/// <summary>
|
||||
/// Some items were added, but not all
|
||||
/// </summary>
|
||||
[Description("Partial")]
|
||||
Partial = 1,
|
||||
/// <summary>
|
||||
/// Everything was imported correctly
|
||||
/// </summary>
|
||||
[Description("Success")]
|
||||
Success = 2
|
||||
}
|
||||
|
||||
public enum CblImportReason
|
||||
{
|
||||
/// <summary>
|
||||
/// The Chapter is not present in Kavita
|
||||
/// </summary>
|
||||
[Description("Chapter missing")]
|
||||
ChapterMissing = 0,
|
||||
/// <summary>
|
||||
/// The Volume is not present in Kavita or no Volume field present in CBL and there is no chapter matching
|
||||
/// </summary>
|
||||
[Description("Volume missing")]
|
||||
VolumeMissing = 1,
|
||||
/// <summary>
|
||||
/// The Series is not present in Kavita or the user does not have access to the Series due to some account restrictions
|
||||
/// </summary>
|
||||
[Description("Series missing")]
|
||||
SeriesMissing = 2,
|
||||
/// <summary>
|
||||
/// The CBL Name conflicts with another Reading List in the system
|
||||
/// </summary>
|
||||
[Description("Name Conflict")]
|
||||
NameConflict = 3,
|
||||
/// <summary>
|
||||
/// Every Series in the Reading list is missing from within Kavita or user has access restrictions to
|
||||
/// </summary>
|
||||
[Description("All Series Missing")]
|
||||
AllSeriesMissing = 4,
|
||||
/// <summary>
|
||||
/// There are no Book entries in the CBL
|
||||
/// </summary>
|
||||
[Description("Empty File")]
|
||||
EmptyFile = 5,
|
||||
/// <summary>
|
||||
/// Series Collides between Libraries
|
||||
/// </summary>
|
||||
[Description("Series Collision")]
|
||||
SeriesCollision = 6,
|
||||
/// <summary>
|
||||
/// Every book chapter is missing or can't be matched
|
||||
/// </summary>
|
||||
[Description("All Chapters Missing")]
|
||||
AllChapterMissing = 7,
|
||||
}
|
||||
|
||||
public class CblBookResult
|
||||
{
|
||||
public string Series { get; set; }
|
||||
public string Volume { get; set; }
|
||||
public string Number { get; set; }
|
||||
public CblImportReason Reason { get; set; }
|
||||
|
||||
public CblBookResult(CblBook book)
|
||||
{
|
||||
Series = book.Series;
|
||||
Volume = book.Volume;
|
||||
Number = book.Number;
|
||||
}
|
||||
|
||||
public CblBookResult()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the summary from the Import of a given CBL
|
||||
/// </summary>
|
||||
public class CblImportSummaryDto
|
||||
{
|
||||
public string CblName { get; set; }
|
||||
public ICollection<CblBookResult> Results { get; set; }
|
||||
public CblImportResult Success { get; set; }
|
||||
public ICollection<CblBookResult> SuccessfulInserts { get; set; }
|
||||
/// <summary>
|
||||
/// A list of Series that are within the CBL but map to multiple libraries within Kavita
|
||||
/// </summary>
|
||||
public IList<SeriesDto> Conflicts { get; set; }
|
||||
public IList<CblConflictQuestion> Conflicts2 { get; set; }
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue