Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

Reading Lists & More (#564)

Joseph Milazzocf7a9aa71e65
diff --git a/API.Benchmark/ParseScannedFilesBenchmarks.cs b/API.Benchmark/ParseScannedFilesBenchmarks.cs
index bc0c810ce..184f45d8c 100644
--- a/API.Benchmark/ParseScannedFilesBenchmarks.cs
+++ b/API.Benchmark/ParseScannedFilesBenchmarks.cs
@@ -35,6 +35,5 @@ namespace API.Benchmark
var parsedSeries = _parseScannedFiles.ScanLibrariesForSeries(LibraryType.Manga, new string[] {libraryPath},
out var totalFiles, out var scanElapsedTime);
}
-
}
}
diff --git a/API.Tests/Parser/MangaParserTests.cs b/API.Tests/Parser/MangaParserTests.cs
index d27f22dd9..939dfce35 100644
--- a/API.Tests/Parser/MangaParserTests.cs
+++ b/API.Tests/Parser/MangaParserTests.cs
@@ -66,6 +66,7 @@ namespace API.Tests.Parser
[InlineData("Noblesse - Episode 406 (52 Pages).7z", "0")]
[InlineData("X-Men v1 #201 (September 2007).cbz", "1")]
[InlineData("Hentai Ouji to Warawanai Neko. - Vol. 06 Ch. 034.5", "6")]
+ [InlineData("The 100 Girlfriends Who Really, Really, Really, Really, Really Love You - Vol. 03 Ch. 023.5 - Volume 3 Extras.cbz", "3")]
public void ParseVolumeTest(string filename, string expected)
{
Assert.Equal(expected, API.Parser.Parser.ParseVolume(filename));
@@ -128,7 +129,6 @@ namespace API.Tests.Parser
[InlineData("Fullmetal Alchemist chapters 101-108.cbz", "Fullmetal Alchemist")]
[InlineData("To Love Ru v09 Uncensored (Ch.071-079).cbz", "To Love Ru")]
[InlineData("[dmntsf.net] One Piece - Digital Colored Comics Vol. 20 Ch. 177 - 30 Million vs 81 Million.cbz", "One Piece - Digital Colored Comics")]
- //[InlineData("Corpse Party -The Anthology- Sachikos game of love Hysteric Birthday 2U Extra Chapter", "Corpse Party -The Anthology- Sachikos game of love Hysteric Birthday 2U")]
[InlineData("Corpse Party -The Anthology- Sachikos game of love Hysteric Birthday 2U Chapter 01", "Corpse Party -The Anthology- Sachikos game of love Hysteric Birthday 2U")]
[InlineData("Vol03_ch15-22.rar", "")]
[InlineData("Love Hina - Special.cbz", "")] // This has to be a fallback case
@@ -157,6 +157,7 @@ namespace API.Tests.Parser
[InlineData("Killing Bites - Vol 11 Chapter 050 Save Me, Nunupi!.cbz", "Killing Bites")]
[InlineData("Mad Chimera World - Volume 005 - Chapter 026.cbz", "Mad Chimera World")]
[InlineData("Hentai Ouji to Warawanai Neko. - Vol. 06 Ch. 034.5", "Hentai Ouji to Warawanai Neko.")]
+ [InlineData("The 100 Girlfriends Who Really, Really, Really, Really, Really Love You - Vol. 03 Ch. 023.5 - Volume 3 Extras.cbz", "The 100 Girlfriends Who Really, Really, Really, Really, Really Love You")]
public void ParseSeriesTest(string filename, string expected)
{
Assert.Equal(expected, API.Parser.Parser.ParseSeries(filename));
diff --git a/API/Controllers/BookController.cs b/API/Controllers/BookController.cs
index d48b75707..dbae6aa09 100644
--- a/API/Controllers/BookController.cs
+++ b/API/Controllers/BookController.cs
@@ -2,6 +2,8 @@
using System.Linq;
using System.Threading.Tasks;
using API.DTOs;
+using API.DTOs.Reader;
+using API.Entities.Enums;
using API.Extensions;
using API.Interfaces;
using API.Interfaces.Services;
@@ -31,12 +33,31 @@ namespace API.Controllers
}
[HttpGet("{chapterId}/book-info")]
- public async Task<ActionResult<string>> GetBookInfo(int chapterId)
+ public async Task<ActionResult<BookInfoDto>> GetBookInfo(int chapterId)
{
+ // PERF: Write this in one DB call - This does not meet NFR
var chapter = await _unitOfWork.VolumeRepository.GetChapterAsync(chapterId);
- using var book = await EpubReader.OpenBookAsync(chapter.Files.ElementAt(0).FilePath);
+ var volume = await _unitOfWork.SeriesRepository.GetVolumeDtoAsync(chapter.VolumeId);
+ if (volume == null) return BadRequest("Could not find Volume");
+ var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(volume.SeriesId);
+ if (series == null) return BadRequest("Series could not be found");
+
+ var bookTitle = string.Empty;
+ if (series.Format == MangaFormat.Epub)
+ {
+ using var book = await EpubReader.OpenBookAsync(chapter.Files.ElementAt(0).FilePath);
+ bookTitle = book.Title;
+ }
+
- return book.Title;
+ return new BookInfoDto()
+ {
+ BookTitle = bookTitle,
+ VolumeId = chapter.VolumeId,
+ SeriesFormat = series.Format,
+ SeriesId = series.Id,
+ LibraryId = series.LibraryId,
+ };
}
[HttpGet("{chapterId}/book-resources")]
diff --git a/API/Controllers/LibraryController.cs b/API/Controllers/LibraryController.cs
index 53c3953ac..25f224a28 100644
--- a/API/Controllers/LibraryController.cs
+++ b/API/Controllers/LibraryController.cs
@@ -225,11 +225,11 @@ namespace API.Controllers
[HttpGet("search")]
public async Task<ActionResult<IEnumerable<SearchResultDto>>> Search(string queryString)
{
- queryString = queryString.Replace(@"%", "");
+ queryString = queryString.Trim().Replace(@"%", "");
- var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
// Get libraries user has access to
- var libraries = (await _unitOfWork.LibraryRepository.GetLibrariesForUserIdAsync(user.Id)).ToList();
+ var libraries = (await _unitOfWork.LibraryRepository.GetLibrariesForUserIdAsync(userId)).ToList();
if (!libraries.Any()) return BadRequest("User does not have access to any libraries");
diff --git a/API/Controllers/OPDSController.cs b/API/Controllers/OPDSController.cs
index 438dfac77..8302c648a 100644
--- a/API/Controllers/OPDSController.cs
+++ b/API/Controllers/OPDSController.cs
@@ -93,6 +93,19 @@ namespace API.Controllers
}
});
feed.Entries.Add(new FeedEntry()
+ {
+ Id = "readingList",
+ Title = "Reading Lists",
+ Content = new FeedEntryContent()
+ {
+ Text = "Browse by Reading Lists"
+ },
+ Links = new List<FeedLink>()
+ {
+ CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, Prefix + $"{apiKey}/reading-list"),
+ }
+ });
+ feed.Entries.Add(new FeedEntry()
{
Id = "allLibraries",
Title = "All Libraries",
@@ -190,6 +203,7 @@ namespace API.Controllers
return CreateXmlResult(SerializeXml(feed));
}
+
[HttpGet("{apiKey}/collections/{collectionId}")]
[Produces("application/xml")]
public async Task<IActionResult> GetCollection(int collectionId, string apiKey, [FromQuery] int pageNumber = 0)
@@ -230,6 +244,76 @@ namespace API.Controllers
}
+ return CreateXmlResult(SerializeXml(feed));
+ }
+
+ [HttpGet("{apiKey}/reading-list")]
+ [Produces("application/xml")]
+ public async Task<IActionResult> GetReadingLists(string apiKey, [FromQuery] int pageNumber = 0)
+ {
+ if (!(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableOpds)
+ return BadRequest("OPDS is not enabled on this server");
+ var user = await GetUser(apiKey);
+
+ var readingLists = await _unitOfWork.ReadingListRepository.GetReadingListDtosForUserAsync(user.Id, true, new UserParams()
+ {
+ PageNumber = pageNumber
+ });
+
+
+ var feed = CreateFeed("All Reading Lists", $"{apiKey}/reading-list", apiKey);
+
+ foreach (var readingListDto in readingLists)
+ {
+ feed.Entries.Add(new FeedEntry()
+ {
+ Id = readingListDto.Id.ToString(),
+ Title = readingListDto.Title,
+ Summary = readingListDto.Summary,
+ Links = new List<FeedLink>()
+ {
+ CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, Prefix + $"{apiKey}/reading-list/{readingListDto.Id}"),
+ }
+ });
+ }
+
+ return CreateXmlResult(SerializeXml(feed));
+ }
+
+ [HttpGet("{apiKey}/reading-list/{readingListId}")]
+ [Produces("application/xml")]
+ public async Task<IActionResult> GetReadingListItems(int readingListId, string apiKey)
+ {
+ if (!(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableOpds)
+ return BadRequest("OPDS is not enabled on this server");
+ var user = await GetUser(apiKey);
+
+ var userWithLists = await _unitOfWork.UserRepository.GetUserWithReadingListsByUsernameAsync(user.UserName);
+ var readingList = userWithLists.ReadingLists.SingleOrDefault(t => t.Id == readingListId);
+ if (readingList == null)
+ {
+ return BadRequest("Reading list does not exist or you don't have access");
+ }
+
+ var feed = CreateFeed(readingList.Title + " Reading List", $"{apiKey}/reading-list/{readingListId}", apiKey);
+
+ var items = await _unitOfWork.ReadingListRepository.GetReadingListItemDtosByIdAsync(readingListId, user.Id);
+ foreach (var item in items)
+ {
+ feed.Entries.Add(new FeedEntry()
+ {
+ Id = item.ChapterId.ToString(),
+ Title = "Chapter " + item.ChapterNumber,
+ Links = new List<FeedLink>()
+ {
+ CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, Prefix + $"{apiKey}/series/{item.SeriesId}/volume/{item.VolumeId}/chapter/{item.ChapterId}"),
+ CreateLink(FeedLinkRelation.Image, FeedLinkType.Image, $"/api/image/chapter-cover?chapterId={item.ChapterId}")
+ }
+ });
+ }
+
+
+
return CreateXmlResult(SerializeXml(feed));
}
diff --git a/API/Controllers/ReaderController.cs b/API/Controllers/ReaderController.cs
index c5ba062d1..2690c8bdb 100644
--- a/API/Controllers/ReaderController.cs
+++ b/API/Controllers/ReaderController.cs
@@ -49,7 +49,7 @@ namespace API.Controllers
[HttpGet("image")]
public async Task<ActionResult> GetImage(int chapterId, int page)
{
- if (page < 0) return BadRequest("Page cannot be less than 0");
+ if (page < 0) page = 0;
var chapter = await _cacheService.Ensure(chapterId);
if (chapter == null) return BadRequest("There was an issue finding image file for reading");
@@ -76,20 +76,21 @@ namespace API.Controllers
/// <summary>
/// Returns various information about a Chapter. Side effect: This will cache the chapter images for reading.
/// </summary>
- /// <param name="seriesId"></param>
+ /// <param name="seriesId">Not used</param>
/// <param name="chapterId"></param>
/// <returns></returns>
[HttpGet("chapter-info")]
public async Task<ActionResult<ChapterInfoDto>> GetChapterInfo(int seriesId, int chapterId)
{
- // PERF: Write this in one DB call
+ // PERF: Write this in one DB call - This does not meet NFR
var chapter = await _cacheService.Ensure(chapterId);
if (chapter == null) return BadRequest("Could not find Chapter");
var volume = await _unitOfWork.SeriesRepository.GetVolumeDtoAsync(chapter.VolumeId);
if (volume == null) return BadRequest("Could not find Volume");
var mangaFile = (await _unitOfWork.VolumeRepository.GetFilesForChapterAsync(chapterId)).First();
- var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(seriesId);
+ var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(volume.SeriesId);
+ if (series == null) return BadRequest("Series could not be found");
return Ok(new ChapterInfoDto()
{
@@ -97,7 +98,10 @@ namespace API.Controllers
VolumeNumber = volume.Number + string.Empty,
VolumeId = volume.Id,
FileName = Path.GetFileName(mangaFile.FilePath),
- SeriesName = series?.Name,
+ SeriesName = series.Name,
+ SeriesFormat = series.Format,
+ SeriesId = series.Id,
+ LibraryId = series.LibraryId,
IsSpecial = chapter.IsSpecial,
Pages = chapter.Pages,
});
@@ -526,8 +530,8 @@ namespace API.Controllers
[HttpGet("next-chapter")]
public async Task<ActionResult<int>> GetNextChapter(int seriesId, int volumeId, int currentChapterId)
{
- var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
- var volumes = await _unitOfWork.SeriesRepository.GetVolumesDtoAsync(seriesId, user.Id);
+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
+ var volumes = await _unitOfWork.SeriesRepository.GetVolumesDtoAsync(seriesId, userId);
var currentVolume = await _unitOfWork.SeriesRepository.GetVolumeAsync(volumeId);
var currentChapter = await _unitOfWork.VolumeRepository.GetChapterAsync(currentChapterId);
if (currentVolume.Number == 0)
@@ -592,8 +596,8 @@ namespace API.Controllers
[HttpGet("prev-chapter")]
public async Task<ActionResult<int>> GetPreviousChapter(int seriesId, int volumeId, int currentChapterId)
{
- var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
- var volumes = await _unitOfWork.SeriesRepository.GetVolumesDtoAsync(seriesId, user.Id);
+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
+ var volumes = await _unitOfWork.SeriesRepository.GetVolumesDtoAsync(seriesId, userId);
var currentVolume = await _unitOfWork.SeriesRepository.GetVolumeAsync(volumeId);
var currentChapter = await _unitOfWork.VolumeRepository.GetChapterAsync(currentChapterId);
diff --git a/API/Controllers/ReadingListController.cs b/API/Controllers/ReadingListController.cs
new file mode 100644
index 000000000..73ed407b8
--- /dev/null
+++ b/API/Controllers/ReadingListController.cs
@@ -0,0 +1,404 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using API.Comparators;
+using API.DTOs.ReadingLists;
+using API.Entities;
+using API.Extensions;
+using API.Helpers;
+using API.Interfaces;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Logging;
+
+namespace API.Controllers
+{
+ public class ReadingListController : BaseApiController
+ {
+ private readonly IUnitOfWork _unitOfWork;
+ private readonly ChapterSortComparerZeroFirst _chapterSortComparerForInChapterSorting = new ChapterSortComparerZeroFirst();
+
+ public ReadingListController(IUnitOfWork unitOfWork)
+ {
+ _unitOfWork = unitOfWork;
+ }
+
+ [HttpGet]
+ public async Task<ActionResult<IEnumerable<ReadingListDto>>> GetList(int readingListId)
+ {
+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
+ return Ok(await _unitOfWork.ReadingListRepository.GetReadingListDtoByIdAsync(readingListId, userId));
+ }
+
+ /// <summary>
+ /// Returns reading lists (paginated) for a given user.
+ /// </summary>
+ /// <param name="includePromoted">Defaults to true</param>
+ /// <returns></returns>
+ [HttpPost("lists")]
+ public async Task<ActionResult<IEnumerable<ReadingListDto>>> GetListsForUser([FromQuery] UserParams userParams, [FromQuery] bool includePromoted = true)
+ {
+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
+ var items = await _unitOfWork.ReadingListRepository.GetReadingListDtosForUserAsync(userId, includePromoted,
+ userParams);
+ Response.AddPaginationHeader(items.CurrentPage, items.PageSize, items.TotalCount, items.TotalPages);
+
+ return Ok(items);
+ }
+
+ /// <summary>
+ /// Fetches all reading list items for a given list including rich metadata around series, volume, chapters, and progress
+ /// </summary>
+ /// <remarks>This call is expensive</remarks>
+ /// <param name="readingListId"></param>
+ /// <returns></returns>
+ [HttpGet("items")]
+ public async Task<ActionResult<IEnumerable<ReadingListItemDto>>> GetListForUser(int readingListId)
+ {
+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
+ var items = await _unitOfWork.ReadingListRepository.GetReadingListItemDtosByIdAsync(readingListId, userId);
+
+ return Ok(await _unitOfWork.ReadingListRepository.AddReadingProgressModifiers(userId, items.ToList()));
+ }
+
+ /// <summary>
+ /// Updates an items position
+ /// </summary>
+ /// <param name="dto"></param>
+ /// <returns></returns>
+ [HttpPost("update-position")]
+ public async Task<ActionResult> UpdateListItemPosition(UpdateReadingListPosition dto)
+ {
+ // Make sure UI buffers events
+ var items = (await _unitOfWork.ReadingListRepository.GetReadingListItemsByIdAsync(dto.ReadingListId)).ToList();
+ var item = items.Find(r => r.Id == dto.ReadingListItemId);
+ items.Remove(item);
+ items.Insert(dto.ToPosition, item);
+
+ for (var i = 0; i < items.Count; i++)
+ {
+ items[i].Order = i;
+ }
+
+ if (_unitOfWork.HasChanges() && await _unitOfWork.CommitAsync())
+ {
+ return Ok("Updated");
+ }
+
+ return BadRequest("Couldn't update position");
+ }
+
+ [HttpPost("delete-item")]
+ public async Task<ActionResult> DeleteListItem(UpdateReadingListPosition dto)
+ {
+ var items = (await _unitOfWork.ReadingListRepository.GetReadingListItemsByIdAsync(dto.ReadingListId)).ToList();
+ var item = items.Find(r => r.Id == dto.ReadingListItemId);
+ items.Remove(item);
+
+ for (var i = 0; i < items.Count; i++)
+ {
+ items[i].Order = i;
+ }
+
+ if (_unitOfWork.HasChanges() && await _unitOfWork.CommitAsync())
+ {
+ return Ok("Updated");
+ }
+
+ return BadRequest("Couldn't delete item");
+ }
+
+ /// <summary>
+ /// Removes all entries that are fully read from the reading list
+ /// </summary>
+ /// <param name="readingListId"></param>
+ /// <returns></returns>
+ [HttpPost("remove-read")]
+ public async Task<ActionResult> DeleteReadFromList([FromQuery] int readingListId)
+ {
+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
+ var items = await _unitOfWork.ReadingListRepository.GetReadingListItemDtosByIdAsync(readingListId, userId);
+ items = await _unitOfWork.ReadingListRepository.AddReadingProgressModifiers(userId, items.ToList());
+
+ // Collect all Ids to remove
+ var itemIdsToRemove = items.Where(item => item.PagesRead == item.PagesTotal).Select(item => item.Id);
+
+ try
+ {
+ var listItems =
+ (await _unitOfWork.ReadingListRepository.GetReadingListItemsByIdAsync(readingListId)).Where(r =>
+ itemIdsToRemove.Contains(r.Id));
+ _unitOfWork.ReadingListRepository.BulkRemove(listItems);
+
+ if (_unitOfWork.HasChanges())
+ {
+ await _unitOfWork.CommitAsync();
+ return Ok("Updated");
+ }
+ else
+ {
+ return Ok("Nothing to remove");
+ }
+ }
+ catch
+ {
+ await _unitOfWork.RollbackAsync();
+ }
+
+ return BadRequest("Could not remove read items");
+ }
+
+ /// <summary>
+ /// Deletes a reading list
+ /// </summary>
+ /// <param name="readingListId"></param>
+ /// <returns></returns>
+ [HttpDelete]
+ public async Task<ActionResult> DeleteList([FromQuery] int readingListId)
+ {
+ var user = await _unitOfWork.UserRepository.GetUserWithReadingListsByUsernameAsync(User.GetUsername());
+ var readingList = user.ReadingLists.SingleOrDefault(r => r.Id == readingListId);
+ if (readingList == null)
+ {
+ return BadRequest("User is not associated with this reading list");
+ }
+
+ user.ReadingLists.Remove(readingList);
+
+ if (_unitOfWork.HasChanges() && await _unitOfWork.CommitAsync())
+ {
+ return Ok("Deleted");
+ }
+
+ return BadRequest("There was an issue deleting reading list");
+ }
+
+ /// <summary>
+ /// Creates a new List with a unique title. Returns the new ReadingList back
+ /// </summary>
+ /// <param name="dto"></param>
+ /// <returns></returns>
+ [HttpPost("create")]
+ public async Task<ActionResult<ReadingListDto>> CreateList(CreateReadingListDto dto)
+ {
+ var user = await _unitOfWork.UserRepository.GetUserWithReadingListsByUsernameAsync(User.GetUsername());
+
+ // When creating, we need to make sure Title is unique
+ var hasExisting = user.ReadingLists.Any(l => l.Title.Equals(dto.Title));
+ if (hasExisting)
+ {
+ return BadRequest("A list of this name already exists");
+ }
+ user.ReadingLists.Add(new ReadingList()
+ {
+ Promoted = false,
+ Title = dto.Title,
+ Summary = string.Empty
+ });
+
+ if (!_unitOfWork.HasChanges()) return BadRequest("There was a problem creating list");
+
+ await _unitOfWork.CommitAsync();
+
+ return Ok(await _unitOfWork.ReadingListRepository.GetReadingListDtoByTitleAsync(dto.Title));
+ }
+
+ [HttpPost("update")]
+ public async Task<ActionResult> UpdateList(UpdateReadingListDto dto)
+ {
+ var readingList = await _unitOfWork.ReadingListRepository.GetReadingListByIdAsync(dto.ReadingListId);
+ if (readingList == null) return BadRequest("List does not exist");
+
+ if (!string.IsNullOrEmpty(dto.Title))
+ {
+ readingList.Title = dto.Title; // Should I check if this is unique?
+ }
+ if (!string.IsNullOrEmpty(dto.Title))
+ {
+ readingList.Summary = dto.Summary;
+ }
+
+ readingList.Promoted = dto.Promoted;
+
+ _unitOfWork.ReadingListRepository.Update(readingList);
+
+ if (await _unitOfWork.CommitAsync())
+ {
+ return Ok("Updated");
+ }
+ return BadRequest("Could not update reading list");
+ }
+
+ [HttpPost("update-by-series")]
+ public async Task<ActionResult> UpdateListBySeries(UpdateReadingListBySeriesDto dto)
+ {
+ var user = await _unitOfWork.UserRepository.GetUserWithReadingListsByUsernameAsync(User.GetUsername());
+ var readingList = user.ReadingLists.SingleOrDefault(l => l.Id == dto.ReadingListId);
+ if (readingList == null) return BadRequest("Reading List does not exist");
+ var chapterIdsForSeries =
+ await _unitOfWork.SeriesRepository.GetChapterIdsForSeriesAsync(new [] {dto.SeriesId});
+
+ // If there are adds, tell tracking this has been modified
+ if (await AddChaptersToReadingList(dto.SeriesId, chapterIdsForSeries, readingList))
+ {
+ _unitOfWork.ReadingListRepository.Update(readingList);
+ }
+
+ try
+ {
+ if (_unitOfWork.HasChanges())
+ {
+ await _unitOfWork.CommitAsync();
+ return Ok("Updated");
+ }
+ }
+ catch
+ {
+ await _unitOfWork.RollbackAsync();
+ }
+
+ return Ok("Nothing to do");
+ }
+
+ [HttpPost("update-by-volume")]
+ public async Task<ActionResult> UpdateListByVolume(UpdateReadingListByVolumeDto dto)
+ {
+ var user = await _unitOfWork.UserRepository.GetUserWithReadingListsByUsernameAsync(User.GetUsername());
+ var readingList = user.ReadingLists.SingleOrDefault(l => l.Id == dto.ReadingListId);
+ if (readingList == null) return BadRequest("Reading List does not exist");
+ var chapterIdsForVolume =
+ (await _unitOfWork.VolumeRepository.GetChaptersAsync(dto.VolumeId)).Select(c => c.Id).ToList();
+
+ // If there are adds, tell tracking this has been modified
+ if (await AddChaptersToReadingList(dto.SeriesId, chapterIdsForVolume, readingList))
+ {
+ _unitOfWork.ReadingListRepository.Update(readingList);
+ }
+
+ try
+ {
+ if (_unitOfWork.HasChanges())
+ {
+ await _unitOfWork.CommitAsync();
+ return Ok("Updated");
+ }
+ }
+ catch
+ {
+ await _unitOfWork.RollbackAsync();
+ }
+
+ return Ok("Nothing to do");
+ }
+
+ [HttpPost("update-by-chapter")]
+ public async Task<ActionResult> UpdateListByChapter(UpdateReadingListByChapterDto dto)
+ {
+ var user = await _unitOfWork.UserRepository.GetUserWithReadingListsByUsernameAsync(User.GetUsername());
+ var readingList = user.ReadingLists.SingleOrDefault(l => l.Id == dto.ReadingListId);
+ if (readingList == null) return BadRequest("Reading List does not exist");
+
+ // If there are adds, tell tracking this has been modified
+ if (await AddChaptersToReadingList(dto.SeriesId, new List<int>() { dto.ChapterId }, readingList))
+ {
+ _unitOfWork.ReadingListRepository.Update(readingList);
+ }
+
+ try
+ {
+ if (_unitOfWork.HasChanges())
+ {
+ await _unitOfWork.CommitAsync();
+ return Ok("Updated");
+ }
+ }
+ catch
+ {
+ await _unitOfWork.RollbackAsync();
+ }
+
+ return Ok("Nothing to do");
+ }
+
+ /// <summary>
+ /// Adds a list of Chapters as reading list items to the passed reading list.
+ /// </summary>
+ /// <param name="seriesId"></param>
+ /// <param name="chapterIds"></param>
+ /// <param name="readingList"></param>
+ /// <returns>True if new chapters were added</returns>
+ private async Task<bool> AddChaptersToReadingList(int seriesId, IList<int> chapterIds,
+ ReadingList readingList)
+ {
+ readingList.Items ??= new List<ReadingListItem>();
+ var lastOrder = 0;
+ if (readingList.Items.Any())
+ {
+ lastOrder = readingList.Items.DefaultIfEmpty().Max(rli => rli.Order);
+ }
+
+ var existingChapterExists = readingList.Items.Select(rli => rli.ChapterId).ToHashSet();
+ var chaptersForSeries = (await _unitOfWork.ChapterRepository.GetChaptersByIdsAsync(chapterIds))
+ .OrderBy(c => int.Parse(c.Volume.Name))
+ .ThenBy(x => double.Parse(x.Number), _chapterSortComparerForInChapterSorting);
+
+ var index = lastOrder + 1;
+ foreach (var chapter in chaptersForSeries)
+ {
+ if (existingChapterExists.Contains(chapter.Id)) continue;
+
+ readingList.Items.Add(new ReadingListItem()
+ {
+ Order = index,
+ ChapterId = chapter.Id,
+ SeriesId = seriesId,
+ VolumeId = chapter.VolumeId
+ });
+ index += 1;
+ }
+
+ return index > lastOrder + 1;
+ }
+
+ /// <summary>
+ /// Returns the next chapter within the reading list
+ /// </summary>
+ /// <param name="currentChapterId"></param>
+ /// <param name="readingListId"></param>
+ /// <returns>Chapter Id for next item, -1 if nothing exists</returns>
+ [HttpGet("next-chapter")]
+ public async Task<ActionResult<int>> GetNextChapter(int currentChapterId, int readingListId)
+ {
+ var items = (await _unitOfWork.ReadingListRepository.GetReadingListItemsByIdAsync(readingListId)).ToList();
+ var readingListItem = items.SingleOrDefault(rl => rl.ChapterId == currentChapterId);
+ if (readingListItem == null) return BadRequest("Id does not exist");
+ var index = items.IndexOf(readingListItem) + 1;
+ if (items.Count > index)
+ {
+ return items[index].ChapterId;
+ }
+
+ return Ok(-1);
+ }
+
+ /// <summary>
+ /// Returns the prev chapter within the reading list
+ /// </summary>
+ /// <param name="currentChapterId"></param>
+ /// <param name="readingListId"></param>
+ /// <returns>Chapter Id for next item, -1 if nothing exists</returns>
+ [HttpGet("prev-chapter")]
+ public async Task<ActionResult<int>> GetPrevChapter(int currentChapterId, int readingListId)
+ {
+ var items = (await _unitOfWork.ReadingListRepository.GetReadingListItemsByIdAsync(readingListId)).ToList();
+ var readingListItem = items.SingleOrDefault(rl => rl.ChapterId == currentChapterId);
+ if (readingListItem == null) return BadRequest("Id does not exist");
+ var index = items.IndexOf(readingListItem) - 1;
+ if (0 <= index)
+ {
+ return items[index].ChapterId;
+ }
+
+ return Ok(-1);
+ }
+ }
+}
diff --git a/API/Controllers/SeriesController.cs b/API/Controllers/SeriesController.cs
index cce70de6d..d64c78fd3 100644
--- a/API/Controllers/SeriesController.cs
+++ b/API/Controllers/SeriesController.cs
@@ -32,14 +32,14 @@ namespace API.Controllers
[HttpPost]
public async Task<ActionResult<IEnumerable<Series>>> GetSeriesForLibrary(int libraryId, [FromQuery] UserParams userParams, [FromBody] FilterDto filterDto)
{
- var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
var series =
- await _unitOfWork.SeriesRepository.GetSeriesDtoForLibraryIdAsync(libraryId, user.Id, userParams, filterDto);
+ await _unitOfWork.SeriesRepository.GetSeriesDtoForLibraryIdAsync(libraryId, userId, userParams, filterDto);
// Apply progress/rating information (I can't work out how to do this in initial query)
if (series == null) return BadRequest("Could not get series for library");
- await _unitOfWork.SeriesRepository.AddSeriesModifiers(user.Id, series);
+ await _unitOfWork.SeriesRepository.AddSeriesModifiers(userId, series);
Response.AddPaginationHeader(series.CurrentPage, series.PageSize, series.TotalCount, series.TotalPages);
@@ -55,10 +55,10 @@ namespace API.Controllers
[HttpGet("{seriesId}")]
public async Task<ActionResult<SeriesDto>> GetSeries(int seriesId)
{
- var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
try
{
- return Ok(await _unitOfWork.SeriesRepository.GetSeriesDtoByIdAsync(seriesId, user.Id));
+ return Ok(await _unitOfWork.SeriesRepository.GetSeriesDtoByIdAsync(seriesId, userId));
}
catch (Exception e)
{
@@ -95,15 +95,15 @@ namespace API.Controllers
[HttpGet("volumes")]
public async Task<ActionResult<IEnumerable<VolumeDto>>> GetVolumes(int seriesId)
{
- var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
- return Ok(await _unitOfWork.SeriesRepository.GetVolumesDtoAsync(seriesId, user.Id));
+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
+ return Ok(await _unitOfWork.SeriesRepository.GetVolumesDtoAsync(seriesId, userId));
}
[HttpGet("volume")]
public async Task<ActionResult<VolumeDto>> GetVolume(int volumeId)
{
- var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
- return Ok(await _unitOfWork.SeriesRepository.GetVolumeDtoAsync(volumeId, user.Id));
+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
+ return Ok(await _unitOfWork.SeriesRepository.GetVolumeDtoAsync(volumeId, userId));
}
[HttpGet("chapter")]
@@ -182,14 +182,14 @@ namespace API.Controllers
[HttpPost("recently-added")]
public async Task<ActionResult<IEnumerable<SeriesDto>>> GetRecentlyAdded(FilterDto filterDto, [FromQuery] UserParams userParams, [FromQuery] int libraryId = 0)
{
- var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
var series =
- await _unitOfWork.SeriesRepository.GetRecentlyAdded(libraryId, user.Id, userParams, filterDto);
+ await _unitOfWork.SeriesRepository.GetRecentlyAdded(libraryId, userId, userParams, filterDto);
// Apply progress/rating information (I can't work out how to do this in initial query)
if (series == null) return BadRequest("Could not get series");
- await _unitOfWork.SeriesRepository.AddSeriesModifiers(user.Id, series);
+ await _unitOfWork.SeriesRepository.AddSeriesModifiers(userId, series);
Response.AddPaginationHeader(series.CurrentPage, series.PageSize, series.TotalCount, series.TotalPages);
@@ -200,8 +200,8 @@ namespace API.Controllers
public async Task<ActionResult<IEnumerable<SeriesDto>>> GetInProgress(FilterDto filterDto, [FromQuery] UserParams userParams, [FromQuery] int libraryId = 0)
{
// NOTE: This has to be done manually like this due to the DistinctBy requirement
- var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
- var results = await _unitOfWork.SeriesRepository.GetInProgress(user.Id, libraryId, userParams, filterDto);
+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
+ var results = await _unitOfWork.SeriesRepository.GetInProgress(userId, libraryId, userParams, filterDto);
var listResults = results.DistinctBy(s => s.Name).Skip((userParams.PageNumber - 1) * userParams.PageSize)
.Take(userParams.PageSize).ToList();
@@ -316,14 +316,14 @@ namespace API.Controllers
[HttpGet("series-by-collection")]
public async Task<ActionResult<IEnumerable<SeriesDto>>> GetSeriesByCollectionTag(int collectionId, [FromQuery] UserParams userParams)
{
- var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
var series =
- await _unitOfWork.SeriesRepository.GetSeriesDtoForCollectionAsync(collectionId, user.Id, userParams);
+ await _unitOfWork.SeriesRepository.GetSeriesDtoForCollectionAsync(collectionId, userId, userParams);
// Apply progress/rating information (I can't work out how to do this in initial query)
if (series == null) return BadRequest("Could not get series for collection");
- await _unitOfWork.SeriesRepository.AddSeriesModifiers(user.Id, series);
+ await _unitOfWork.SeriesRepository.AddSeriesModifiers(userId, series);
Response.AddPaginationHeader(series.CurrentPage, series.PageSize, series.TotalCount, series.TotalPages);
@@ -339,8 +339,8 @@ namespace API.Controllers
public async Task<ActionResult<IEnumerable<SeriesDto>>> GetAllSeriesById(SeriesByIdsDto dto)
{
if (dto.SeriesIds == null) return BadRequest("Must pass seriesIds");
- var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
- return Ok(await _unitOfWork.SeriesRepository.GetSeriesDtoForIdsAsync(dto.SeriesIds, user.Id));
+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
+ return Ok(await _unitOfWork.SeriesRepository.GetSeriesDtoForIdsAsync(dto.SeriesIds, userId));
}
diff --git a/API/Controllers/SettingsController.cs b/API/Controllers/SettingsController.cs
index 4d81eb22d..acd1b61e8 100644
--- a/API/Controllers/SettingsController.cs
+++ b/API/Controllers/SettingsController.cs
@@ -103,7 +103,7 @@ namespace API.Controllers
}
else
{
- _taskScheduler.ScheduleStatsTasks();
+ await _taskScheduler.ScheduleStatsTasks();
}
}
}
diff --git a/API/Controllers/UsersController.cs b/API/Controllers/UsersController.cs
index ee4c9ac66..c35e368cc 100644
--- a/API/Controllers/UsersController.cs
+++ b/API/Controllers/UsersController.cs
@@ -18,7 +18,7 @@ namespace API.Controllers
{
_unitOfWork = unitOfWork;
}
-
+
[Authorize(Policy = "RequireAdminRole")]
[HttpDelete("delete-user")]
public async Task<ActionResult> DeleteUser(string username)
@@ -30,7 +30,7 @@ namespace API.Controllers
return BadRequest("Could not delete the user.");
}
-
+
[Authorize(Policy = "RequireAdminRole")]
[HttpGet]
public async Task<ActionResult<IEnumerable<MemberDto>>> GetUsers()
@@ -42,8 +42,8 @@ namespace API.Controllers
public async Task<ActionResult<bool>> HasReadingProgress(int libraryId)
{
var library = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(libraryId);
- var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
- return Ok(await _unitOfWork.AppUserProgressRepository.UserHasProgress(library.Type, user.Id));
+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
+ return Ok(await _unitOfWork.AppUserProgressRepository.UserHasProgress(library.Type, userId));
}
[HttpGet("has-library-access")]
@@ -77,8 +77,8 @@ namespace API.Controllers
{
return Ok(preferencesDto);
}
-
+
return BadRequest("There was an issue saving preferences.");
}
}
-}
\ No newline at end of file
+}
diff --git a/API/DTOs/Reader/BookInfoDto.cs b/API/DTOs/Reader/BookInfoDto.cs
new file mode 100644
index 000000000..0404ab5e3
--- /dev/null
+++ b/API/DTOs/Reader/BookInfoDto.cs
@@ -0,0 +1,13 @@
+using API.Entities.Enums;
+
+namespace API.DTOs.Reader
+{
+ public class BookInfoDto
+ {
+ public string BookTitle { get; set; }
+ public int SeriesId { get; set; }
+ public int VolumeId { get; set; }
+ public MangaFormat SeriesFormat { get; set; }
+ public int LibraryId { get; set; }
+ }
+}
diff --git a/API/DTOs/Reader/ChapterInfoDto.cs b/API/DTOs/Reader/ChapterInfoDto.cs
index 850149016..3ad1c96e2 100644
--- a/API/DTOs/Reader/ChapterInfoDto.cs
+++ b/API/DTOs/Reader/ChapterInfoDto.cs
@@ -1,16 +1,21 @@
-namespace API.DTOs.Reader
+using API.Entities.Enums;
+
+namespace API.DTOs.Reader
{
public class ChapterInfoDto
{
-
+
public string ChapterNumber { get; set; }
public string VolumeNumber { get; set; }
public int VolumeId { get; set; }
public string SeriesName { get; set; }
+ public MangaFormat SeriesFormat { get; set; }
+ public int SeriesId { get; set; }
+ public int LibraryId { get; set; }
public string ChapterTitle { get; set; } = "";
public int Pages { get; set; }
public string FileName { get; set; }
public bool IsSpecial { get; set; }
-
+
}
-}
\ No newline at end of file
+}
diff --git a/API/DTOs/ReadingLists/CreateReadingListDto.cs b/API/DTOs/ReadingLists/CreateReadingListDto.cs
new file mode 100644
index 000000000..c32b62bea
--- /dev/null
+++ b/API/DTOs/ReadingLists/CreateReadingListDto.cs
@@ -0,0 +1,7 @@
+namespace API.DTOs.ReadingLists
+{
+ public class CreateReadingListDto
+ {
+ public string Title { get; init; }
+ }
+}
diff --git a/API/DTOs/ReadingLists/ReadingListDto.cs b/API/DTOs/ReadingLists/ReadingListDto.cs
new file mode 100644
index 000000000..e3837a2e3
--- /dev/null
+++ b/API/DTOs/ReadingLists/ReadingListDto.cs
@@ -0,0 +1,13 @@
+namespace API.DTOs.ReadingLists
+{
+ public class ReadingListDto
+ {
+ public int Id { get; init; }
+ public string Title { get; set; }
+ public string Summary { get; set; }
+ /// <summary>
+ /// Reading lists that are promoted are only done by admins
+ /// </summary>
+ public bool Promoted { get; set; }
+ }
+}
diff --git a/API/DTOs/ReadingLists/ReadingListItemDto.cs b/API/DTOs/ReadingLists/ReadingListItemDto.cs
new file mode 100644
index 000000000..b58fdcf80
--- /dev/null
+++ b/API/DTOs/ReadingLists/ReadingListItemDto.cs
@@ -0,0 +1,25 @@
+using API.Entities.Enums;
+
+namespace API.DTOs.ReadingLists
+{
+ public class ReadingListItemDto
+ {
+ public int Id { get; init; }
+ public int Order { get; init; }
+ public int ChapterId { get; init; }
+ public int SeriesId { get; init; }
+ public string SeriesName { get; set; }
+ public MangaFormat SeriesFormat { get; set; }
+ public int PagesRead { get; set; }
+ public int PagesTotal { get; set; }
+ public string ChapterNumber { get; set; }
+ public string VolumeNumber { get; set; }
+ public int VolumeId { get; set; }
+ public int LibraryId { get; set; }
+ public string Title { get; set; }
+ /// <summary>
+ /// Used internally only
+ /// </summary>
+ public int ReadingListId { get; set; }
+ }
+}
diff --git a/API/DTOs/ReadingLists/UpdateReadingListByChapterDto.cs b/API/DTOs/ReadingLists/UpdateReadingListByChapterDto.cs
new file mode 100644
index 000000000..887850755
--- /dev/null
+++ b/API/DTOs/ReadingLists/UpdateReadingListByChapterDto.cs
@@ -0,0 +1,9 @@
+namespace API.DTOs.ReadingLists
+{
+ public class UpdateReadingListByChapterDto
+ {
+ public int ChapterId { get; init; }
+ public int SeriesId { get; init; }
+ public int ReadingListId { get; init; }
+ }
+}
diff --git a/API/DTOs/ReadingLists/UpdateReadingListBySeriesDto.cs b/API/DTOs/ReadingLists/UpdateReadingListBySeriesDto.cs
new file mode 100644
index 000000000..1040a9218
--- /dev/null
+++ b/API/DTOs/ReadingLists/UpdateReadingListBySeriesDto.cs
@@ -0,0 +1,8 @@
+namespace API.DTOs.ReadingLists
+{
+ public class UpdateReadingListBySeriesDto
+ {
+ public int SeriesId { get; init; }
+ public int ReadingListId { get; init; }
+ }
+}
diff --git a/API/DTOs/ReadingLists/UpdateReadingListByVolumeDto.cs b/API/DTOs/ReadingLists/UpdateReadingListByVolumeDto.cs
new file mode 100644
index 000000000..0d903d48e
--- /dev/null
+++ b/API/DTOs/ReadingLists/UpdateReadingListByVolumeDto.cs
@@ -0,0 +1,9 @@
+namespace API.DTOs.ReadingLists
+{
+ public class UpdateReadingListByVolumeDto
+ {
+ public int VolumeId { get; init; }
+ public int SeriesId { get; init; }
+ public int ReadingListId { get; init; }
+ }
+}
diff --git a/API/DTOs/ReadingLists/UpdateReadingListDto.cs b/API/DTOs/ReadingLists/UpdateReadingListDto.cs
new file mode 100644
index 000000000..a9f6f0d59
--- /dev/null
+++ b/API/DTOs/ReadingLists/UpdateReadingListDto.cs
@@ -0,0 +1,10 @@
+namespace API.DTOs.ReadingLists
+{
+ public class UpdateReadingListDto
+ {
+ public int ReadingListId { get; set; }
+ public string Title { get; set; }
+ public string Summary { get; set; }
+ public bool Promoted { get; set; }
+ }
+}
diff --git a/API/DTOs/ReadingLists/UpdateReadingListPosition.cs b/API/DTOs/ReadingLists/UpdateReadingListPosition.cs
new file mode 100644
index 000000000..023849024
--- /dev/null
+++ b/API/DTOs/ReadingLists/UpdateReadingListPosition.cs
@@ -0,0 +1,10 @@
+namespace API.DTOs.ReadingLists
+{
+ public class UpdateReadingListPosition
+ {
+ public int ReadingListId { get; set; }
+ public int ReadingListItemId { get; set; }
+ public int FromPosition { get; set; }
+ public int ToPosition { get; set; }
+ }
+}
diff --git a/API/DTOs/VolumeDto.cs b/API/DTOs/VolumeDto.cs
index 3fc165a6d..7fffb79a0 100644
--- a/API/DTOs/VolumeDto.cs
+++ b/API/DTOs/VolumeDto.cs
@@ -14,6 +14,7 @@ namespace API.DTOs
public DateTime LastModified { get; set; }
public DateTime Created { get; set; }
public bool IsSpecial { get; set; }
+ public int SeriesId { get; set; }
public ICollection<ChapterDto> Chapters { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/API/Data/BookmarkRepository.cs b/API/Data/BookmarkRepository.cs
deleted file mode 100644
index af212bc72..000000000
--- a/API/Data/BookmarkRepository.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace API.Data
-{
- public class BookmarkRepository
- {
-
- }
-}
diff --git a/API/Data/DataContext.cs b/API/Data/DataContext.cs
index 62765f607..8e4dc263e 100644
--- a/API/Data/DataContext.cs
+++ b/API/Data/DataContext.cs
@@ -35,6 +35,9 @@ namespace API.Data
public DbSet<SeriesMetadata> SeriesMetadata { get; set; }
public DbSet<CollectionTag> CollectionTag { get; set; }
public DbSet<AppUserBookmark> AppUserBookmark { get; set; }
+ public DbSet<ReadingList> ReadingList { get; set; }
+ public DbSet<ReadingListItem> ReadingListItem { get; set; }
+
protected override void OnModelCreating(ModelBuilder builder)
{
diff --git a/API/Data/Migrations/20210901150310_ReadingLists.Designer.cs b/API/Data/Migrations/20210901150310_ReadingLists.Designer.cs
new file mode 100644
index 000000000..fef65fdcf
--- /dev/null
+++ b/API/Data/Migrations/20210901150310_ReadingLists.Designer.cs
@@ -0,0 +1,1018 @@
+// <auto-generated />
+using System;
+using API.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+namespace API.Data.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20210901150310_ReadingLists")]
+ partial class ReadingLists
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "5.0.8");
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasDatabaseName("RoleNameIndex");
+
+ b.ToTable("AspNetRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AccessFailedCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ApiKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Email")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("EmailConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastActive")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LockoutEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTimeOffset?>("LockoutEnd")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedEmail")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedUserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PasswordHash")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PhoneNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("PhoneNumberConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SecurityStamp")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("TwoFactorEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedEmail")
+ .HasDatabaseName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasDatabaseName("UserNameIndex");
+
+ b.ToTable("AspNetUsers");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Page")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("AppUserBookmark");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AutoCloseMenu")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderDarkMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookReaderFontFamily")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("BookReaderFontSize")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderLineSpacing")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderMargin")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderTapToPaginate")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PageSplitOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReaderMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ScalingOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("SiteDarkMode")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId")
+ .IsUnique();
+
+ b.ToTable("AppUserPreferences");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookScrollId")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("PagesRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("AppUserProgresses");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Rating")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Review")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("AppUserRating");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<byte[]>("CoverImage")
+ .HasColumnType("BLOB");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("IsSpecial")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Number")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Range")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.CollectionTag", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<byte[]>("CoverImage")
+ .HasColumnType("BLOB");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Id", "Promoted")
+ .IsUnique();
+
+ b.ToTable("CollectionTag");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Path")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LibraryId");
+
+ b.ToTable("FolderPath");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Type")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("FilePath")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.ToTable("MangaFile");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("ReadingList");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Order")
+ .HasColumnType("INTEGER");
+
+ b.Property<int?>("ReadingListId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ReadingListId");
+
+ b.HasIndex("SeriesId", "VolumeId", "ChapterId", "LibraryId")
+ .IsUnique();
+
+ b.ToTable("ReadingListItem");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<byte[]>("CoverImage")
+ .HasColumnType("BLOB");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LocalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("OriginalName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SortName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LibraryId");
+
+ b.HasIndex("Name", "NormalizedName", "LocalizedName", "LibraryId", "Format")
+ .IsUnique();
+
+ b.ToTable("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.SeriesMetadata", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId")
+ .IsUnique();
+
+ b.HasIndex("Id", "SeriesId")
+ .IsUnique();
+
+ b.ToTable("SeriesMetadata");
+ });
+
+ modelBuilder.Entity("API.Entities.ServerSetting", b =>
+ {
+ b.Property<int>("Key")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Key");
+
+ b.ToTable("ServerSetting");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<byte[]>("CoverImage")
+ .HasColumnType("BLOB");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Number")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("Volume");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.Property<int>("AppUsersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("LibrariesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("AppUsersId", "LibrariesId");
+
+ b.HasIndex("LibrariesId");
+
+ b.ToTable("AppUserLibrary");
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.Property<int>("CollectionTagsId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("CollectionTagsId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("CollectionTagSeriesMetadata");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderDisplayName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Bookmarks")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithOne("UserPreferences")
+ .HasForeignKey("API.Entities.AppUserPreferences", "AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Progresses")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Ratings")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.HasOne("API.Entities.AppRole", "Role")
+ .WithMany("UserRoles")
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.AppUser", "User")
+ .WithMany("UserRoles")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Role");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany("Chapters")
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Folders")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany("Files")
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("ReadingLists")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.HasOne("API.Entities.ReadingList", null)
+ .WithMany("Items")
+ .HasForeignKey("ReadingListId");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Series")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.SeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithOne("Metadata")
+ .HasForeignKey("API.Entities.SeriesMetadata", "SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany("Volumes")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("AppUsersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Library", null)
+ .WithMany()
+ .HasForeignKey("LibrariesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.CollectionTag", null)
+ .WithMany()
+ .HasForeignKey("CollectionTagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppRole", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Navigation("UserRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Navigation("Bookmarks");
+
+ b.Navigation("Progresses");
+
+ b.Navigation("Ratings");
+
+ b.Navigation("ReadingLists");
+
+ b.Navigation("UserPreferences");
+
+ b.Navigation("UserRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Navigation("Files");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Navigation("Folders");
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Navigation("Items");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Navigation("Metadata");
+
+ b.Navigation("Volumes");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Navigation("Chapters");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/API/Data/Migrations/20210901150310_ReadingLists.cs b/API/Data/Migrations/20210901150310_ReadingLists.cs
new file mode 100644
index 000000000..709d3e17a
--- /dev/null
+++ b/API/Data/Migrations/20210901150310_ReadingLists.cs
@@ -0,0 +1,84 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace API.Data.Migrations
+{
+ public partial class ReadingLists : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "ReadingList",
+ columns: table => new
+ {
+ Id = table.Column<int>(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ Title = table.Column<string>(type: "TEXT", nullable: true),
+ Summary = table.Column<string>(type: "TEXT", nullable: true),
+ Promoted = table.Column<bool>(type: "INTEGER", nullable: false),
+ Created = table.Column<DateTime>(type: "TEXT", nullable: false),
+ LastModified = table.Column<DateTime>(type: "TEXT", nullable: false),
+ AppUserId = table.Column<int>(type: "INTEGER", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ReadingList", x => x.Id);
+ table.ForeignKey(
+ name: "FK_ReadingList_AspNetUsers_AppUserId",
+ column: x => x.AppUserId,
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "ReadingListItem",
+ columns: table => new
+ {
+ Id = table.Column<int>(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ LibraryId = table.Column<int>(type: "INTEGER", nullable: false),
+ SeriesId = table.Column<int>(type: "INTEGER", nullable: false),
+ VolumeId = table.Column<int>(type: "INTEGER", nullable: false),
+ ChapterId = table.Column<int>(type: "INTEGER", nullable: false),
+ Order = table.Column<int>(type: "INTEGER", nullable: false),
+ ReadingListId = table.Column<int>(type: "INTEGER", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ReadingListItem", x => x.Id);
+ table.ForeignKey(
+ name: "FK_ReadingListItem_ReadingList_ReadingListId",
+ column: x => x.ReadingListId,
+ principalTable: "ReadingList",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_ReadingList_AppUserId",
+ table: "ReadingList",
+ column: "AppUserId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_ReadingListItem_ReadingListId",
+ table: "ReadingListItem",
+ column: "ReadingListId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_ReadingListItem_SeriesId_VolumeId_ChapterId_LibraryId",
+ table: "ReadingListItem",
+ columns: new[] { "SeriesId", "VolumeId", "ChapterId", "LibraryId" },
+ unique: true);
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "ReadingListItem");
+
+ migrationBuilder.DropTable(
+ name: "ReadingList");
+ }
+ }
+}
diff --git a/API/Data/Migrations/20210901200442_ReadingListsAdditions.Designer.cs b/API/Data/Migrations/20210901200442_ReadingListsAdditions.Designer.cs
new file mode 100644
index 000000000..8ee5bdec8
--- /dev/null
+++ b/API/Data/Migrations/20210901200442_ReadingListsAdditions.Designer.cs
@@ -0,0 +1,1022 @@
+// <auto-generated />
+using System;
+using API.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+namespace API.Data.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20210901200442_ReadingListsAdditions")]
+ partial class ReadingListsAdditions
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "5.0.8");
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasDatabaseName("RoleNameIndex");
+
+ b.ToTable("AspNetRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AccessFailedCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ApiKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Email")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("EmailConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastActive")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LockoutEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTimeOffset?>("LockoutEnd")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedEmail")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedUserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PasswordHash")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PhoneNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("PhoneNumberConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SecurityStamp")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("TwoFactorEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedEmail")
+ .HasDatabaseName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasDatabaseName("UserNameIndex");
+
+ b.ToTable("AspNetUsers");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Page")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("AppUserBookmark");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AutoCloseMenu")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderDarkMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookReaderFontFamily")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("BookReaderFontSize")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderLineSpacing")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderMargin")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderTapToPaginate")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PageSplitOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReaderMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ScalingOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("SiteDarkMode")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId")
+ .IsUnique();
+
+ b.ToTable("AppUserPreferences");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookScrollId")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("PagesRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("AppUserProgresses");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Rating")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Review")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("AppUserRating");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<byte[]>("CoverImage")
+ .HasColumnType("BLOB");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("IsSpecial")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Number")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Range")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.CollectionTag", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<byte[]>("CoverImage")
+ .HasColumnType("BLOB");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Id", "Promoted")
+ .IsUnique();
+
+ b.ToTable("CollectionTag");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Path")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LibraryId");
+
+ b.ToTable("FolderPath");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Type")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("FilePath")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.ToTable("MangaFile");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("ReadingList");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Order")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingListId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ReadingListId");
+
+ b.HasIndex("SeriesId", "VolumeId", "ChapterId", "LibraryId")
+ .IsUnique();
+
+ b.ToTable("ReadingListItem");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<byte[]>("CoverImage")
+ .HasColumnType("BLOB");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LocalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("OriginalName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SortName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LibraryId");
+
+ b.HasIndex("Name", "NormalizedName", "LocalizedName", "LibraryId", "Format")
+ .IsUnique();
+
+ b.ToTable("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.SeriesMetadata", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId")
+ .IsUnique();
+
+ b.HasIndex("Id", "SeriesId")
+ .IsUnique();
+
+ b.ToTable("SeriesMetadata");
+ });
+
+ modelBuilder.Entity("API.Entities.ServerSetting", b =>
+ {
+ b.Property<int>("Key")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Key");
+
+ b.ToTable("ServerSetting");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<byte[]>("CoverImage")
+ .HasColumnType("BLOB");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Number")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("Volume");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.Property<int>("AppUsersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("LibrariesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("AppUsersId", "LibrariesId");
+
+ b.HasIndex("LibrariesId");
+
+ b.ToTable("AppUserLibrary");
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.Property<int>("CollectionTagsId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("CollectionTagsId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("CollectionTagSeriesMetadata");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderDisplayName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Bookmarks")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithOne("UserPreferences")
+ .HasForeignKey("API.Entities.AppUserPreferences", "AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Progresses")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Ratings")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.HasOne("API.Entities.AppRole", "Role")
+ .WithMany("UserRoles")
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.AppUser", "User")
+ .WithMany("UserRoles")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Role");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany("Chapters")
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Folders")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany("Files")
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("ReadingLists")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.HasOne("API.Entities.ReadingList", "ReadingList")
+ .WithMany("Items")
+ .HasForeignKey("ReadingListId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("ReadingList");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Series")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.SeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithOne("Metadata")
+ .HasForeignKey("API.Entities.SeriesMetadata", "SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany("Volumes")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("AppUsersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Library", null)
+ .WithMany()
+ .HasForeignKey("LibrariesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.CollectionTag", null)
+ .WithMany()
+ .HasForeignKey("CollectionTagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppRole", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Navigation("UserRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Navigation("Bookmarks");
+
+ b.Navigation("Progresses");
+
+ b.Navigation("Ratings");
+
+ b.Navigation("ReadingLists");
+
+ b.Navigation("UserPreferences");
+
+ b.Navigation("UserRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Navigation("Files");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Navigation("Folders");
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Navigation("Items");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Navigation("Metadata");
+
+ b.Navigation("Volumes");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Navigation("Chapters");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/API/Data/Migrations/20210901200442_ReadingListsAdditions.cs b/API/Data/Migrations/20210901200442_ReadingListsAdditions.cs
new file mode 100644
index 000000000..b44c2ac4d
--- /dev/null
+++ b/API/Data/Migrations/20210901200442_ReadingListsAdditions.cs
@@ -0,0 +1,55 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace API.Data.Migrations
+{
+ public partial class ReadingListsAdditions : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_ReadingListItem_ReadingList_ReadingListId",
+ table: "ReadingListItem");
+
+ migrationBuilder.AlterColumn<int>(
+ name: "ReadingListId",
+ table: "ReadingListItem",
+ type: "INTEGER",
+ nullable: false,
+ defaultValue: 0,
+ oldClrType: typeof(int),
+ oldType: "INTEGER",
+ oldNullable: true);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_ReadingListItem_ReadingList_ReadingListId",
+ table: "ReadingListItem",
+ column: "ReadingListId",
+ principalTable: "ReadingList",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_ReadingListItem_ReadingList_ReadingListId",
+ table: "ReadingListItem");
+
+ migrationBuilder.AlterColumn<int>(
+ name: "ReadingListId",
+ table: "ReadingListItem",
+ type: "INTEGER",
+ nullable: true,
+ oldClrType: typeof(int),
+ oldType: "INTEGER");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_ReadingListItem_ReadingList_ReadingListId",
+ table: "ReadingListItem",
+ column: "ReadingListId",
+ principalTable: "ReadingList",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+ }
+ }
+}
diff --git a/API/Data/Migrations/20210902110705_ReadingListsExtraRealationships.Designer.cs b/API/Data/Migrations/20210902110705_ReadingListsExtraRealationships.Designer.cs
new file mode 100644
index 000000000..566d2c5be
--- /dev/null
+++ b/API/Data/Migrations/20210902110705_ReadingListsExtraRealationships.Designer.cs
@@ -0,0 +1,1050 @@
+// <auto-generated />
+using System;
+using API.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+namespace API.Data.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20210902110705_ReadingListsExtraRealationships")]
+ partial class ReadingListsExtraRealationships
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "5.0.8");
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasDatabaseName("RoleNameIndex");
+
+ b.ToTable("AspNetRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AccessFailedCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ApiKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Email")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("EmailConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastActive")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LockoutEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTimeOffset?>("LockoutEnd")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedEmail")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedUserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PasswordHash")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PhoneNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("PhoneNumberConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SecurityStamp")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("TwoFactorEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedEmail")
+ .HasDatabaseName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasDatabaseName("UserNameIndex");
+
+ b.ToTable("AspNetUsers");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Page")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("AppUserBookmark");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AutoCloseMenu")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderDarkMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookReaderFontFamily")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("BookReaderFontSize")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderLineSpacing")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderMargin")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderTapToPaginate")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PageSplitOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReaderMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ScalingOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("SiteDarkMode")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId")
+ .IsUnique();
+
+ b.ToTable("AppUserPreferences");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookScrollId")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("PagesRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("AppUserProgresses");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Rating")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Review")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("AppUserRating");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<byte[]>("CoverImage")
+ .HasColumnType("BLOB");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("IsSpecial")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Number")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Range")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.CollectionTag", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<byte[]>("CoverImage")
+ .HasColumnType("BLOB");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Id", "Promoted")
+ .IsUnique();
+
+ b.ToTable("CollectionTag");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Path")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LibraryId");
+
+ b.ToTable("FolderPath");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Type")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("FilePath")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.ToTable("MangaFile");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("ReadingList");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Order")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingListId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.HasIndex("ReadingListId");
+
+ b.HasIndex("VolumeId");
+
+ b.HasIndex("SeriesId", "VolumeId", "ChapterId", "LibraryId")
+ .IsUnique();
+
+ b.ToTable("ReadingListItem");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<byte[]>("CoverImage")
+ .HasColumnType("BLOB");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LocalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("OriginalName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SortName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LibraryId");
+
+ b.HasIndex("Name", "NormalizedName", "LocalizedName", "LibraryId", "Format")
+ .IsUnique();
+
+ b.ToTable("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.SeriesMetadata", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId")
+ .IsUnique();
+
+ b.HasIndex("Id", "SeriesId")
+ .IsUnique();
+
+ b.ToTable("SeriesMetadata");
+ });
+
+ modelBuilder.Entity("API.Entities.ServerSetting", b =>
+ {
+ b.Property<int>("Key")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Key");
+
+ b.ToTable("ServerSetting");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<byte[]>("CoverImage")
+ .HasColumnType("BLOB");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Number")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("Volume");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.Property<int>("AppUsersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("LibrariesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("AppUsersId", "LibrariesId");
+
+ b.HasIndex("LibrariesId");
+
+ b.ToTable("AppUserLibrary");
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.Property<int>("CollectionTagsId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("CollectionTagsId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("CollectionTagSeriesMetadata");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderDisplayName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Bookmarks")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithOne("UserPreferences")
+ .HasForeignKey("API.Entities.AppUserPreferences", "AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Progresses")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Ratings")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.HasOne("API.Entities.AppRole", "Role")
+ .WithMany("UserRoles")
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.AppUser", "User")
+ .WithMany("UserRoles")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Role");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany("Chapters")
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Folders")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany("Files")
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("ReadingLists")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany()
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.ReadingList", "ReadingList")
+ .WithMany("Items")
+ .HasForeignKey("ReadingListId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany()
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany()
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+
+ b.Navigation("ReadingList");
+
+ b.Navigation("Series");
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Series")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.SeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithOne("Metadata")
+ .HasForeignKey("API.Entities.SeriesMetadata", "SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany("Volumes")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("AppUsersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Library", null)
+ .WithMany()
+ .HasForeignKey("LibrariesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.CollectionTag", null)
+ .WithMany()
+ .HasForeignKey("CollectionTagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppRole", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Navigation("UserRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Navigation("Bookmarks");
+
+ b.Navigation("Progresses");
+
+ b.Navigation("Ratings");
+
+ b.Navigation("ReadingLists");
+
+ b.Navigation("UserPreferences");
+
+ b.Navigation("UserRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Navigation("Files");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Navigation("Folders");
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Navigation("Items");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Navigation("Metadata");
+
+ b.Navigation("Volumes");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Navigation("Chapters");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/API/Data/Migrations/20210902110705_ReadingListsExtraRealationships.cs b/API/Data/Migrations/20210902110705_ReadingListsExtraRealationships.cs
new file mode 100644
index 000000000..9ddb1b5fc
--- /dev/null
+++ b/API/Data/Migrations/20210902110705_ReadingListsExtraRealationships.cs
@@ -0,0 +1,67 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace API.Data.Migrations
+{
+ public partial class ReadingListsExtraRealationships : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateIndex(
+ name: "IX_ReadingListItem_ChapterId",
+ table: "ReadingListItem",
+ column: "ChapterId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_ReadingListItem_VolumeId",
+ table: "ReadingListItem",
+ column: "VolumeId");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_ReadingListItem_Chapter_ChapterId",
+ table: "ReadingListItem",
+ column: "ChapterId",
+ principalTable: "Chapter",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_ReadingListItem_Series_SeriesId",
+ table: "ReadingListItem",
+ column: "SeriesId",
+ principalTable: "Series",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_ReadingListItem_Volume_VolumeId",
+ table: "ReadingListItem",
+ column: "VolumeId",
+ principalTable: "Volume",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_ReadingListItem_Chapter_ChapterId",
+ table: "ReadingListItem");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_ReadingListItem_Series_SeriesId",
+ table: "ReadingListItem");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_ReadingListItem_Volume_VolumeId",
+ table: "ReadingListItem");
+
+ migrationBuilder.DropIndex(
+ name: "IX_ReadingListItem_ChapterId",
+ table: "ReadingListItem");
+
+ migrationBuilder.DropIndex(
+ name: "IX_ReadingListItem_VolumeId",
+ table: "ReadingListItem");
+ }
+ }
+}
diff --git a/API/Data/Migrations/20210906140845_ReadingListsChanges.Designer.cs b/API/Data/Migrations/20210906140845_ReadingListsChanges.Designer.cs
new file mode 100644
index 000000000..836a496e0
--- /dev/null
+++ b/API/Data/Migrations/20210906140845_ReadingListsChanges.Designer.cs
@@ -0,0 +1,1046 @@
+// <auto-generated />
+using System;
+using API.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+namespace API.Data.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20210906140845_ReadingListsChanges")]
+ partial class ReadingListsChanges
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "5.0.8");
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasDatabaseName("RoleNameIndex");
+
+ b.ToTable("AspNetRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AccessFailedCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ApiKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Email")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("EmailConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastActive")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LockoutEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTimeOffset?>("LockoutEnd")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedEmail")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedUserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PasswordHash")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PhoneNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("PhoneNumberConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SecurityStamp")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("TwoFactorEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedEmail")
+ .HasDatabaseName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasDatabaseName("UserNameIndex");
+
+ b.ToTable("AspNetUsers");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Page")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("AppUserBookmark");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AutoCloseMenu")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderDarkMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookReaderFontFamily")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("BookReaderFontSize")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderLineSpacing")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderMargin")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderTapToPaginate")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PageSplitOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReaderMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ScalingOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("SiteDarkMode")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId")
+ .IsUnique();
+
+ b.ToTable("AppUserPreferences");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookScrollId")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("PagesRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("AppUserProgresses");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Rating")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Review")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("AppUserRating");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<byte[]>("CoverImage")
+ .HasColumnType("BLOB");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("IsSpecial")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Number")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Range")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.CollectionTag", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<byte[]>("CoverImage")
+ .HasColumnType("BLOB");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Id", "Promoted")
+ .IsUnique();
+
+ b.ToTable("CollectionTag");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Path")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LibraryId");
+
+ b.ToTable("FolderPath");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Type")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("FilePath")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.ToTable("MangaFile");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("ReadingList");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Order")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingListId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.HasIndex("ReadingListId");
+
+ b.HasIndex("SeriesId");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("ReadingListItem");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<byte[]>("CoverImage")
+ .HasColumnType("BLOB");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LocalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("OriginalName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SortName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LibraryId");
+
+ b.HasIndex("Name", "NormalizedName", "LocalizedName", "LibraryId", "Format")
+ .IsUnique();
+
+ b.ToTable("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.SeriesMetadata", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId")
+ .IsUnique();
+
+ b.HasIndex("Id", "SeriesId")
+ .IsUnique();
+
+ b.ToTable("SeriesMetadata");
+ });
+
+ modelBuilder.Entity("API.Entities.ServerSetting", b =>
+ {
+ b.Property<int>("Key")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Key");
+
+ b.ToTable("ServerSetting");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<byte[]>("CoverImage")
+ .HasColumnType("BLOB");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Number")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("Volume");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.Property<int>("AppUsersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("LibrariesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("AppUsersId", "LibrariesId");
+
+ b.HasIndex("LibrariesId");
+
+ b.ToTable("AppUserLibrary");
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.Property<int>("CollectionTagsId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("CollectionTagsId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("CollectionTagSeriesMetadata");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderDisplayName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Bookmarks")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithOne("UserPreferences")
+ .HasForeignKey("API.Entities.AppUserPreferences", "AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Progresses")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Ratings")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.HasOne("API.Entities.AppRole", "Role")
+ .WithMany("UserRoles")
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.AppUser", "User")
+ .WithMany("UserRoles")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Role");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany("Chapters")
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Folders")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany("Files")
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("ReadingLists")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany()
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.ReadingList", "ReadingList")
+ .WithMany("Items")
+ .HasForeignKey("ReadingListId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany()
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany()
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+
+ b.Navigation("ReadingList");
+
+ b.Navigation("Series");
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Series")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.SeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithOne("Metadata")
+ .HasForeignKey("API.Entities.SeriesMetadata", "SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany("Volumes")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("AppUsersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Library", null)
+ .WithMany()
+ .HasForeignKey("LibrariesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.CollectionTag", null)
+ .WithMany()
+ .HasForeignKey("CollectionTagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppRole", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Navigation("UserRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Navigation("Bookmarks");
+
+ b.Navigation("Progresses");
+
+ b.Navigation("Ratings");
+
+ b.Navigation("ReadingLists");
+
+ b.Navigation("UserPreferences");
+
+ b.Navigation("UserRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Navigation("Files");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Navigation("Folders");
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Navigation("Items");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Navigation("Metadata");
+
+ b.Navigation("Volumes");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Navigation("Chapters");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/API/Data/Migrations/20210906140845_ReadingListsChanges.cs b/API/Data/Migrations/20210906140845_ReadingListsChanges.cs
new file mode 100644
index 000000000..e4ea07e2e
--- /dev/null
+++ b/API/Data/Migrations/20210906140845_ReadingListsChanges.cs
@@ -0,0 +1,43 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace API.Data.Migrations
+{
+ public partial class ReadingListsChanges : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropIndex(
+ name: "IX_ReadingListItem_SeriesId_VolumeId_ChapterId_LibraryId",
+ table: "ReadingListItem");
+
+ migrationBuilder.DropColumn(
+ name: "LibraryId",
+ table: "ReadingListItem");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_ReadingListItem_SeriesId",
+ table: "ReadingListItem",
+ column: "SeriesId");
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropIndex(
+ name: "IX_ReadingListItem_SeriesId",
+ table: "ReadingListItem");
+
+ migrationBuilder.AddColumn<int>(
+ name: "LibraryId",
+ table: "ReadingListItem",
+ type: "INTEGER",
+ nullable: false,
+ defaultValue: 0);
+
+ migrationBuilder.CreateIndex(
+ name: "IX_ReadingListItem_SeriesId_VolumeId_ChapterId_LibraryId",
+ table: "ReadingListItem",
+ columns: new[] { "SeriesId", "VolumeId", "ChapterId", "LibraryId" },
+ unique: true);
+ }
+ }
+}
diff --git a/API/Data/Migrations/DataContextModelSnapshot.cs b/API/Data/Migrations/DataContextModelSnapshot.cs
index 9f763c03b..0d2c3681e 100644
--- a/API/Data/Migrations/DataContextModelSnapshot.cs
+++ b/API/Data/Migrations/DataContextModelSnapshot.cs
@@ -440,6 +440,71 @@ namespace API.Data.Migrations
b.ToTable("MangaFile");
});
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("ReadingList");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Order")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingListId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.HasIndex("ReadingListId");
+
+ b.HasIndex("SeriesId");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("ReadingListItem");
+ });
+
modelBuilder.Entity("API.Entities.Series", b =>
{
b.Property<int>("Id")
@@ -780,6 +845,52 @@ namespace API.Data.Migrations
b.Navigation("Chapter");
});
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("ReadingLists")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany()
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.ReadingList", "ReadingList")
+ .WithMany("Items")
+ .HasForeignKey("ReadingListId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany()
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany()
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+
+ b.Navigation("ReadingList");
+
+ b.Navigation("Series");
+
+ b.Navigation("Volume");
+ });
+
modelBuilder.Entity("API.Entities.Series", b =>
{
b.HasOne("API.Entities.Library", "Library")
@@ -892,6 +1003,8 @@ namespace API.Data.Migrations
b.Navigation("Ratings");
+ b.Navigation("ReadingLists");
+
b.Navigation("UserPreferences");
b.Navigation("UserRoles");
@@ -909,6 +1022,11 @@ namespace API.Data.Migrations
b.Navigation("Series");
});
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Navigation("Items");
+ });
+
modelBuilder.Entity("API.Entities.Series", b =>
{
b.Navigation("Metadata");
diff --git a/API/Data/AppUserProgressRepository.cs b/API/Data/Repositories/AppUserProgressRepository.cs
similarity index 96%
rename from API/Data/AppUserProgressRepository.cs
rename to API/Data/Repositories/AppUserProgressRepository.cs
index 38912b589..6aa19d84c 100644
--- a/API/Data/AppUserProgressRepository.cs
+++ b/API/Data/Repositories/AppUserProgressRepository.cs
@@ -2,9 +2,10 @@
using System.Threading.Tasks;
using API.Entities.Enums;
using API.Interfaces;
+using API.Interfaces.Repositories;
using Microsoft.EntityFrameworkCore;
-namespace API.Data
+namespace API.Data.Repositories
{
public class AppUserProgressRepository : IAppUserProgressRepository
{
@@ -25,7 +26,7 @@ namespace API.Data
var rowsToRemove = await _context.AppUserProgresses
.Where(progress => !chapterIds.Contains(progress.ChapterId))
.ToListAsync();
-
+
_context.RemoveRange(rowsToRemove);
return await _context.SaveChangesAsync() > 0 ? rowsToRemove.Count : 0;
}
@@ -45,7 +46,7 @@ namespace API.Data
.ToListAsync();
if (seriesIds.Count == 0) return false;
-
+
return await _context.Series
.Include(s => s.Library)
.Where(s => seriesIds.Contains(s.Id) && s.Library.Type == libraryType)
@@ -53,4 +54,4 @@ namespace API.Data
.AnyAsync();
}
}
-}
\ No newline at end of file
+}
diff --git a/API/Data/ChapterRepository.cs b/API/Data/Repositories/ChapterRepository.cs
similarity index 53%
rename from API/Data/ChapterRepository.cs
rename to API/Data/Repositories/ChapterRepository.cs
index e3510adc4..56839a97c 100644
--- a/API/Data/ChapterRepository.cs
+++ b/API/Data/Repositories/ChapterRepository.cs
@@ -1,8 +1,11 @@
-using API.Entities;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using API.Entities;
using API.Interfaces.Repositories;
using Microsoft.EntityFrameworkCore;
-namespace API.Data
+namespace API.Data.Repositories
{
public class ChapterRepository : IChapterRepository
{
@@ -18,6 +21,14 @@ namespace API.Data
_context.Entry(chapter).State = EntityState.Modified;
}
+ public async Task<IEnumerable<Chapter>> GetChaptersByIdsAsync(IList<int> chapterIds)
+ {
+ return await _context.Chapter
+ .Where(c => chapterIds.Contains(c.Id))
+ .Include(c => c.Volume)
+ .ToListAsync();
+ }
+
// TODO: Move over Chapter based queries here
}
}
diff --git a/API/Data/CollectionTagRepository.cs b/API/Data/Repositories/CollectionTagRepository.cs
similarity index 98%
rename from API/Data/CollectionTagRepository.cs
rename to API/Data/Repositories/CollectionTagRepository.cs
index b694b0bb8..514540308 100644
--- a/API/Data/CollectionTagRepository.cs
+++ b/API/Data/Repositories/CollectionTagRepository.cs
@@ -4,11 +4,12 @@ using System.Threading.Tasks;
using API.DTOs;
using API.Entities;
using API.Interfaces;
+using API.Interfaces.Repositories;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using Microsoft.EntityFrameworkCore;
-namespace API.Data
+namespace API.Data.Repositories
{
public class CollectionTagRepository : ICollectionTagRepository
{
diff --git a/API/Data/FileRepository.cs b/API/Data/Repositories/FileRepository.cs
similarity index 92%
rename from API/Data/FileRepository.cs
rename to API/Data/Repositories/FileRepository.cs
index c3234abba..2a0da6f20 100644
--- a/API/Data/FileRepository.cs
+++ b/API/Data/Repositories/FileRepository.cs
@@ -3,9 +3,10 @@ using System.IO;
using System.Linq;
using System.Threading.Tasks;
using API.Interfaces;
+using API.Interfaces.Repositories;
using Microsoft.EntityFrameworkCore;
-namespace API.Data
+namespace API.Data.Repositories
{
public class FileRepository : IFileRepository
{
diff --git a/API/Data/LibraryRepository.cs b/API/Data/Repositories/LibraryRepository.cs
similarity index 98%
rename from API/Data/LibraryRepository.cs
rename to API/Data/Repositories/LibraryRepository.cs
index 23ad6ea76..5594eb71e 100644
--- a/API/Data/LibraryRepository.cs
+++ b/API/Data/Repositories/LibraryRepository.cs
@@ -5,11 +5,12 @@ using API.DTOs;
using API.Entities;
using API.Entities.Enums;
using API.Interfaces;
+using API.Interfaces.Repositories;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using Microsoft.EntityFrameworkCore;
-namespace API.Data
+namespace API.Data.Repositories
{
public class LibraryRepository : ILibraryRepository
{
diff --git a/API/Data/Repositories/ReadingListRepository.cs b/API/Data/Repositories/ReadingListRepository.cs
new file mode 100644
index 000000000..4f44bc943
--- /dev/null
+++ b/API/Data/Repositories/ReadingListRepository.cs
@@ -0,0 +1,178 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using API.DTOs.ReadingLists;
+using API.Entities;
+using API.Helpers;
+using API.Interfaces.Repositories;
+using AutoMapper;
+using AutoMapper.QueryableExtensions;
+using Microsoft.EntityFrameworkCore;
+
+namespace API.Data.Repositories
+{
+ public class ReadingListRepository : IReadingListRepository
+ {
+ private readonly DataContext _context;
+ private readonly IMapper _mapper;
+
+ public ReadingListRepository(DataContext context, IMapper mapper)
+ {
+ _context = context;
+ _mapper = mapper;
+ }
+
+ public void Update(ReadingList list)
+ {
+ _context.Entry(list).State = EntityState.Modified;
+ }
+
+ public void Remove(ReadingListItem item)
+ {
+ _context.ReadingListItem.Remove(item);
+ }
+
+ public void BulkRemove(IEnumerable<ReadingListItem> items)
+ {
+ _context.ReadingListItem.RemoveRange(items);
+ }
+
+
+ public async Task<PagedList<ReadingListDto>> GetReadingListDtosForUserAsync(int userId, bool includePromoted, UserParams userParams)
+ {
+ var query = _context.ReadingList
+ .Where(l => l.AppUserId == userId || (includePromoted && l.Promoted ))
+ .OrderBy(l => l.LastModified)
+ .ProjectTo<ReadingListDto>(_mapper.ConfigurationProvider)
+ .AsNoTracking();
+
+ return await PagedList<ReadingListDto>.CreateAsync(query, userParams.PageNumber, userParams.PageSize);
+ }
+
+ public async Task<ReadingList> GetReadingListByIdAsync(int readingListId)
+ {
+ return await _context.ReadingList
+ .Where(r => r.Id == readingListId)
+ .Include(r => r.Items)
+ .SingleOrDefaultAsync();
+ }
+
+ public async Task<IEnumerable<ReadingListItemDto>> GetReadingListItemDtosByIdAsync(int readingListId, int userId)
+ {
+ var userLibraries = _context.Library
+ .Include(l => l.AppUsers)
+ .Where(library => library.AppUsers.Any(user => user.Id == userId))
+ .AsNoTracking()
+ .Select(library => library.Id)
+ .ToList();
+
+ var items = await _context.ReadingListItem
+ .Where(s => s.ReadingListId == readingListId)
+ .Join(_context.Chapter, s => s.ChapterId, chapter => chapter.Id, (data, chapter) => new
+ {
+ TotalPages = chapter.Pages,
+ ChapterNumber = chapter.Range,
+ readingListItem = data
+ })
+ .Join(_context.Volume, s => s.readingListItem.VolumeId, volume => volume.Id, (data, volume) => new
+ {
+ data.readingListItem,
+ data.TotalPages,
+ data.ChapterNumber,
+ VolumeId = volume.Id,
+ VolumeNumber = volume.Name,
+ })
+ .Join(_context.Series, s => s.readingListItem.SeriesId, series => series.Id,
+ (data, s) => new
+ {
+ SeriesName = s.Name,
+ SeriesFormat = s.Format,
+ s.LibraryId,
+ data.readingListItem,
+ data.TotalPages,
+ data.ChapterNumber,
+ data.VolumeNumber,
+ data.VolumeId
+ })
+ .Select(data => new ReadingListItemDto()
+ {
+ Id = data.readingListItem.Id,
+ ChapterId = data.readingListItem.ChapterId,
+ Order = data.readingListItem.Order,
+ SeriesId = data.readingListItem.SeriesId,
+ SeriesName = data.SeriesName,
+ SeriesFormat = data.SeriesFormat,
+ PagesTotal = data.TotalPages,
+ ChapterNumber = data.ChapterNumber,
+ VolumeNumber = data.VolumeNumber,
+ LibraryId = data.LibraryId,
+ VolumeId = data.VolumeId,
+ ReadingListId = data.readingListItem.ReadingListId
+ })
+ .Where(o => userLibraries.Contains(o.LibraryId))
+ .OrderBy(rli => rli.Order)
+ .AsNoTracking()
+ .ToListAsync();
+
+ // Attach progress information
+ var fetchedChapterIds = items.Select(i => i.ChapterId);
+ var progresses = await _context.AppUserProgresses
+ .Where(p => fetchedChapterIds.Contains(p.ChapterId))
+ .AsNoTracking()
+ .ToListAsync();
+
+ foreach (var progress in progresses)
+ {
+ var progressItem = items.SingleOrDefault(i => i.ChapterId == progress.ChapterId && i.ReadingListId == readingListId);
+ if (progressItem == null) continue;
+
+ progressItem.PagesRead = progress.PagesRead;
+ }
+
+ return items;
+ }
+
+ public async Task<ReadingListDto> GetReadingListDtoByIdAsync(int readingListId, int userId)
+ {
+ return await _context.ReadingList
+ .Where(r => r.Id == readingListId && (r.AppUserId == userId || r.Promoted))
+ .ProjectTo<ReadingListDto>(_mapper.ConfigurationProvider)
+ .SingleOrDefaultAsync();
+ }
+
+ public async Task<IEnumerable<ReadingListItemDto>> AddReadingProgressModifiers(int userId, IList<ReadingListItemDto> items)
+ {
+ var chapterIds = items.Select(i => i.ChapterId).Distinct().ToList();
+ var userProgress = await _context.AppUserProgresses
+ .Where(p => p.AppUserId == userId && chapterIds.Contains(p.ChapterId))
+ .AsNoTracking()
+ .ToListAsync();
+
+ foreach (var item in items)
+ {
+ var progress = userProgress.Where(p => p.ChapterId == item.ChapterId);
+ item.PagesRead = progress.Sum(p => p.PagesRead);
+ }
+
+ return items;
+ }
+
+ public async Task<ReadingListDto> GetReadingListDtoByTitleAsync(string title)
+ {
+ return await _context.ReadingList
+ .Where(r => r.Title.Equals(title))
+ .ProjectTo<ReadingListDto>(_mapper.ConfigurationProvider)
+ .SingleOrDefaultAsync();
+ }
+
+ public async Task<IEnumerable<ReadingListItem>> GetReadingListItemsByIdAsync(int readingListId)
+ {
+ return await _context.ReadingListItem
+ .Where(r => r.ReadingListId == readingListId)
+ .OrderBy(r => r.Order)
+ .ToListAsync();
+ }
+
+
+ }
+}
diff --git a/API/Data/SeriesRepository.cs b/API/Data/Repositories/SeriesRepository.cs
similarity index 97%
rename from API/Data/SeriesRepository.cs
rename to API/Data/Repositories/SeriesRepository.cs
index b9e2f16cd..2ef318bb9 100644
--- a/API/Data/SeriesRepository.cs
+++ b/API/Data/Repositories/SeriesRepository.cs
@@ -8,11 +8,12 @@ using API.Entities;
using API.Extensions;
using API.Helpers;
using API.Interfaces;
+using API.Interfaces.Repositories;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using Microsoft.EntityFrameworkCore;
-namespace API.Data
+namespace API.Data.Repositories
{
public class SeriesRepository : ISeriesRepository
{
@@ -221,21 +222,17 @@ namespace API.Data
public async Task<int[]> GetChapterIdsForSeriesAsync(int[] seriesIds)
{
- var series = await _context.Series
- .Where(s => seriesIds.Contains(s.Id))
- .Include(s => s.Volumes)
- .ThenInclude(v => v.Chapters)
+ var volumes = await _context.Volume
+ .Where(v => seriesIds.Contains(v.SeriesId))
+ .Include(v => v.Chapters)
.ToListAsync();
IList<int> chapterIds = new List<int>();
- foreach (var s in series)
+ foreach (var v in volumes)
{
- foreach (var v in s.Volumes)
+ foreach (var c in v.Chapters)
{
- foreach (var c in v.Chapters)
- {
- chapterIds.Add(c.Id);
- }
+ chapterIds.Add(c.Id);
}
}
diff --git a/API/Data/SettingsRepository.cs b/API/Data/Repositories/SettingsRepository.cs
similarity index 95%
rename from API/Data/SettingsRepository.cs
rename to API/Data/Repositories/SettingsRepository.cs
index ecacf0f87..c6fe21961 100644
--- a/API/Data/SettingsRepository.cs
+++ b/API/Data/Repositories/SettingsRepository.cs
@@ -5,10 +5,11 @@ using API.DTOs;
using API.Entities;
using API.Entities.Enums;
using API.Interfaces;
+using API.Interfaces.Repositories;
using AutoMapper;
using Microsoft.EntityFrameworkCore;
-namespace API.Data
+namespace API.Data.Repositories
{
public class SettingsRepository : ISettingsRepository
{
@@ -45,4 +46,4 @@ namespace API.Data
return await _context.ServerSetting.ToListAsync();
}
}
-}
\ No newline at end of file
+}
diff --git a/API/Data/UserRepository.cs b/API/Data/Repositories/UserRepository.cs
similarity index 84%
rename from API/Data/UserRepository.cs
rename to API/Data/Repositories/UserRepository.cs
index 2e0b9e7f3..d6d3e80df 100644
--- a/API/Data/UserRepository.cs
+++ b/API/Data/Repositories/UserRepository.cs
@@ -5,12 +5,13 @@ using API.Constants;
using API.DTOs;
using API.Entities;
using API.Interfaces;
+using API.Interfaces.Repositories;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
-namespace API.Data
+namespace API.Data.Repositories
{
public class UserRepository : IUserRepository
{
@@ -54,10 +55,36 @@ namespace API.Data
}
/// <summary>
- /// Gets an AppUser by id. Returns back Progress information.
+ /// This fetches the Id for a user. Use whenever you just need an ID.
+ /// </summary>
+ /// <param name="username"></param>
+ /// <returns></returns>
+ public async Task<int> GetUserIdByUsernameAsync(string username)
+ {
+ return await _context.Users
+ .Where(x => x.UserName == username)
+ .Select(u => u.Id)
+ .SingleOrDefaultAsync();
+ }
+
+ /// <summary>
+ /// Gets an AppUser by username. Returns back Reading List and their Items.
/// </summary>
/// <param name="username"></param>
/// <returns></returns>
+ public async Task<AppUser> GetUserWithReadingListsByUsernameAsync(string username)
+ {
+ return await _context.Users
+ .Include(u => u.ReadingLists)
+ .ThenInclude(l => l.Items)
+ .SingleOrDefaultAsync(x => x.UserName == username);
+ }
+
+ /// <summary>
+ /// Gets an AppUser by id. Returns back Progress information.
+ /// </summary>
+ /// <param name="id"></param>
+ /// <returns></returns>
public async Task<AppUser> GetUserByIdAsync(int id)
{
return await _context.Users
diff --git a/API/Data/VolumeRepository.cs b/API/Data/Repositories/VolumeRepository.cs
similarity index 98%
rename from API/Data/VolumeRepository.cs
rename to API/Data/Repositories/VolumeRepository.cs
index c10a3a04e..46260c411 100644
--- a/API/Data/VolumeRepository.cs
+++ b/API/Data/Repositories/VolumeRepository.cs
@@ -4,11 +4,12 @@ using System.Threading.Tasks;
using API.DTOs;
using API.Entities;
using API.Interfaces;
+using API.Interfaces.Repositories;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using Microsoft.EntityFrameworkCore;
-namespace API.Data
+namespace API.Data.Repositories
{
public class VolumeRepository : IVolumeRepository
{
diff --git a/API/Data/UnitOfWork.cs b/API/Data/UnitOfWork.cs
index 25ac5654c..5d931c790 100644
--- a/API/Data/UnitOfWork.cs
+++ b/API/Data/UnitOfWork.cs
@@ -1,4 +1,5 @@
using System.Threading.Tasks;
+using API.Data.Repositories;
using API.Entities;
using API.Interfaces;
using API.Interfaces.Repositories;
@@ -32,6 +33,7 @@ namespace API.Data
public ICollectionTagRepository CollectionTagRepository => new CollectionTagRepository(_context, _mapper);
public IFileRepository FileRepository => new FileRepository(_context);
public IChapterRepository ChapterRepository => new ChapterRepository(_context);
+ public IReadingListRepository ReadingListRepository => new ReadingListRepository(_context, _mapper);
/// <summary>
/// Commits changes to the DB. Completes the open transaction.
@@ -39,7 +41,6 @@ namespace API.Data
/// <returns></returns>
public bool Commit()
{
-
return _context.SaveChanges() > 0;
}
/// <summary>
diff --git a/API/Entities/AppUser.cs b/API/Entities/AppUser.cs
index c4a24e405..b959fac1a 100644
--- a/API/Entities/AppUser.cs
+++ b/API/Entities/AppUser.cs
@@ -18,6 +18,10 @@ namespace API.Entities
public AppUserPreferences UserPreferences { get; set; }
public ICollection<AppUserBookmark> Bookmarks { get; set; }
/// <summary>
+ /// Reading lists associated with this user
+ /// </summary>
+ public ICollection<ReadingList> ReadingLists { get; set; }
+ /// <summary>
/// An API Key to interact with external services, like OPDS
/// </summary>
public string ApiKey { get; set; }
diff --git a/API/Entities/ReadingList.cs b/API/Entities/ReadingList.cs
new file mode 100644
index 000000000..ef0b4bd9c
--- /dev/null
+++ b/API/Entities/ReadingList.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using API.Entities.Interfaces;
+
+namespace API.Entities
+{
+ /// <summary>
+ /// This is a collection of <see cref="ReadingListItem"/> which represent individual chapters and an order.
+ /// </summary>
+ public class ReadingList : IEntityDate
+ {
+ public int Id { get; init; }
+ public string Title { get; set; }
+ public string Summary { get; set; }
+ /// <summary>
+ /// Reading lists that are promoted are only done by admins
+ /// </summary>
+ public bool Promoted { get; set; }
+
+ public ICollection<ReadingListItem> Items { get; set; }
+ public DateTime Created { get; set; }
+ public DateTime LastModified { get; set; }
+
+ // Relationships
+ public int AppUserId { get; set; }
+ public AppUser AppUser { get; set; }
+
+ }
+}
diff --git a/API/Entities/ReadingListItem.cs b/API/Entities/ReadingListItem.cs
new file mode 100644
index 000000000..4a18d1c27
--- /dev/null
+++ b/API/Entities/ReadingListItem.cs
@@ -0,0 +1,27 @@
+using Microsoft.EntityFrameworkCore;
+
+namespace API.Entities
+{
+ //[Index(nameof(SeriesId), nameof(VolumeId), nameof(ChapterId), IsUnique = true)]
+ public class ReadingListItem
+ {
+ public int Id { get; init; }
+ public int SeriesId { get; set; }
+ public int VolumeId { get; set; }
+ public int ChapterId { get; set; }
+ /// <summary>
+ /// Order of the chapter within a Reading List
+ /// </summary>
+ public int Order { get; set; }
+
+ // Relationship
+ public ReadingList ReadingList { get; set; }
+ public int ReadingListId { get; set; }
+
+ // Idea, keep these for easy join statements
+ public Series Series { get; set; }
+ public Volume Volume { get; set; }
+ public Chapter Chapter { get; set; }
+
+ }
+}
diff --git a/API/Extensions/FileInfoExtensions.cs b/API/Extensions/FileInfoExtensions.cs
index a52141611..f7e1291e7 100644
--- a/API/Extensions/FileInfoExtensions.cs
+++ b/API/Extensions/FileInfoExtensions.cs
@@ -14,7 +14,6 @@ namespace API.Extensions
public static bool HasFileBeenModifiedSince(this FileInfo fileInfo, DateTime comparison)
{
return DateTime.Compare(fileInfo.LastWriteTime, comparison) > 0;
- //return fileInfo?.LastWriteTime > comparison;
}
}
}
diff --git a/API/Helpers/AutoMapperProfiles.cs b/API/Helpers/AutoMapperProfiles.cs
index 084a7d28c..138a9d593 100644
--- a/API/Helpers/AutoMapperProfiles.cs
+++ b/API/Helpers/AutoMapperProfiles.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using API.DTOs;
+using API.DTOs.ReadingLists;
using API.Entities;
using API.Helpers.Converters;
using AutoMapper;
@@ -31,6 +32,9 @@ namespace API.Helpers
CreateMap<AppUserBookmark, BookmarkDto>();
+ CreateMap<ReadingList, ReadingListDto>();
+ CreateMap<ReadingListItem, ReadingListItemDto>();
+
CreateMap<Series, SearchResultDto>()
.ForMember(dest => dest.SeriesId,
opt => opt.MapFrom(src => src.Id))
diff --git a/API/Interfaces/IUnitOfWork.cs b/API/Interfaces/IUnitOfWork.cs
index 3f7b12146..06b47bbe8 100644
--- a/API/Interfaces/IUnitOfWork.cs
+++ b/API/Interfaces/IUnitOfWork.cs
@@ -14,6 +14,7 @@ namespace API.Interfaces
ICollectionTagRepository CollectionTagRepository { get; }
IFileRepository FileRepository { get; }
IChapterRepository ChapterRepository { get; }
+ IReadingListRepository ReadingListRepository { get; }
bool Commit();
Task<bool> CommitAsync();
bool HasChanges();
diff --git a/API/Interfaces/IAppUserProgressRepository.cs b/API/Interfaces/Repositories/IAppUserProgressRepository.cs
similarity index 85%
rename from API/Interfaces/IAppUserProgressRepository.cs
rename to API/Interfaces/Repositories/IAppUserProgressRepository.cs
index 96ada0c50..62449e895 100644
--- a/API/Interfaces/IAppUserProgressRepository.cs
+++ b/API/Interfaces/Repositories/IAppUserProgressRepository.cs
@@ -1,11 +1,11 @@
using System.Threading.Tasks;
using API.Entities.Enums;
-namespace API.Interfaces
+namespace API.Interfaces.Repositories
{
public interface IAppUserProgressRepository
{
Task<int> CleanupAbandonedChapters();
Task<bool> UserHasProgress(LibraryType libraryType, int userId);
}
-}
\ No newline at end of file
+}
diff --git a/API/Interfaces/Repositories/IChapterRepository.cs b/API/Interfaces/Repositories/IChapterRepository.cs
index 9f3f39a13..508f14e24 100644
--- a/API/Interfaces/Repositories/IChapterRepository.cs
+++ b/API/Interfaces/Repositories/IChapterRepository.cs
@@ -1,9 +1,13 @@
-using API.Entities;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using API.DTOs;
+using API.Entities;
namespace API.Interfaces.Repositories
{
public interface IChapterRepository
{
void Update(Chapter chapter);
+ Task<IEnumerable<Chapter>> GetChaptersByIdsAsync(IList<int> chapterIds);
}
}
diff --git a/API/Interfaces/ICollectionTagRepository.cs b/API/Interfaces/Repositories/ICollectionTagRepository.cs
similarity index 95%
rename from API/Interfaces/ICollectionTagRepository.cs
rename to API/Interfaces/Repositories/ICollectionTagRepository.cs
index 62f813c9d..39f814e4c 100644
--- a/API/Interfaces/ICollectionTagRepository.cs
+++ b/API/Interfaces/Repositories/ICollectionTagRepository.cs
@@ -3,7 +3,7 @@ using System.Threading.Tasks;
using API.DTOs;
using API.Entities;
-namespace API.Interfaces
+namespace API.Interfaces.Repositories
{
public interface ICollectionTagRepository
{
diff --git a/API/Interfaces/IFileRepository.cs b/API/Interfaces/Repositories/IFileRepository.cs
similarity index 81%
rename from API/Interfaces/IFileRepository.cs
rename to API/Interfaces/Repositories/IFileRepository.cs
index cde587855..a852032d7 100644
--- a/API/Interfaces/IFileRepository.cs
+++ b/API/Interfaces/Repositories/IFileRepository.cs
@@ -1,10 +1,10 @@
using System.Collections.Generic;
using System.Threading.Tasks;
-namespace API.Interfaces
+namespace API.Interfaces.Repositories
{
public interface IFileRepository
{
Task<IEnumerable<string>> GetFileExtensions();
}
-}
\ No newline at end of file
+}
diff --git a/API/Interfaces/ILibraryRepository.cs b/API/Interfaces/Repositories/ILibraryRepository.cs
similarity index 96%
rename from API/Interfaces/ILibraryRepository.cs
rename to API/Interfaces/Repositories/ILibraryRepository.cs
index 4977d38d5..4d9b03fe4 100644
--- a/API/Interfaces/ILibraryRepository.cs
+++ b/API/Interfaces/Repositories/ILibraryRepository.cs
@@ -4,7 +4,7 @@ using API.DTOs;
using API.Entities;
using API.Entities.Enums;
-namespace API.Interfaces
+namespace API.Interfaces.Repositories
{
public interface ILibraryRepository
{
diff --git a/API/Interfaces/Repositories/IReadingListRepository.cs b/API/Interfaces/Repositories/IReadingListRepository.cs
new file mode 100644
index 000000000..8b5ab085d
--- /dev/null
+++ b/API/Interfaces/Repositories/IReadingListRepository.cs
@@ -0,0 +1,22 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using API.DTOs.ReadingLists;
+using API.Entities;
+using API.Helpers;
+
+namespace API.Interfaces.Repositories
+{
+ public interface IReadingListRepository
+ {
+ Task<PagedList<ReadingListDto>> GetReadingListDtosForUserAsync(int userId, bool includePromoted, UserParams userParams);
+ Task<ReadingList> GetReadingListByIdAsync(int readingListId);
+ Task<IEnumerable<ReadingListItemDto>> GetReadingListItemDtosByIdAsync(int readingListId, int userId);
+ Task<ReadingListDto> GetReadingListDtoByIdAsync(int readingListId, int userId);
+ Task<IEnumerable<ReadingListItemDto>> AddReadingProgressModifiers(int userId, IList<ReadingListItemDto> items);
+ Task<ReadingListDto> GetReadingListDtoByTitleAsync(string title);
+ Task<IEnumerable<ReadingListItem>> GetReadingListItemsByIdAsync(int readingListId);
+ void Remove(ReadingListItem item);
+ void BulkRemove(IEnumerable<ReadingListItem> items);
+ void Update(ReadingList list);
+ }
+}
diff --git a/API/Interfaces/ISeriesRepository.cs b/API/Interfaces/Repositories/ISeriesRepository.cs
similarity index 98%
rename from API/Interfaces/ISeriesRepository.cs
rename to API/Interfaces/Repositories/ISeriesRepository.cs
index a5518fc60..7388dee48 100644
--- a/API/Interfaces/ISeriesRepository.cs
+++ b/API/Interfaces/Repositories/ISeriesRepository.cs
@@ -5,7 +5,7 @@ using API.DTOs.Filtering;
using API.Entities;
using API.Helpers;
-namespace API.Interfaces
+namespace API.Interfaces.Repositories
{
public interface ISeriesRepository
{
diff --git a/API/Interfaces/ISettingsRepository.cs b/API/Interfaces/Repositories/ISettingsRepository.cs
similarity index 90%
rename from API/Interfaces/ISettingsRepository.cs
rename to API/Interfaces/Repositories/ISettingsRepository.cs
index 5b0994d41..f1687743d 100644
--- a/API/Interfaces/ISettingsRepository.cs
+++ b/API/Interfaces/Repositories/ISettingsRepository.cs
@@ -4,7 +4,7 @@ using API.DTOs;
using API.Entities;
using API.Entities.Enums;
-namespace API.Interfaces
+namespace API.Interfaces.Repositories
{
public interface ISettingsRepository
{
@@ -12,6 +12,6 @@ namespace API.Interfaces
Task<ServerSettingDto> GetSettingsDtoAsync();
Task<ServerSetting> GetSettingAsync(ServerSettingKey key);
Task<IEnumerable<ServerSetting>> GetSettingsAsync();
-
+
}
-}
\ No newline at end of file
+}
diff --git a/API/Interfaces/IUserRepository.cs b/API/Interfaces/Repositories/IUserRepository.cs
similarity index 86%
rename from API/Interfaces/IUserRepository.cs
rename to API/Interfaces/Repositories/IUserRepository.cs
index c58eafdfc..01bbd4e3a 100644
--- a/API/Interfaces/IUserRepository.cs
+++ b/API/Interfaces/Repositories/IUserRepository.cs
@@ -3,7 +3,7 @@ using System.Threading.Tasks;
using API.DTOs;
using API.Entities;
-namespace API.Interfaces
+namespace API.Interfaces.Repositories
{
public interface IUserRepository
{
@@ -11,6 +11,8 @@ namespace API.Interfaces
void Update(AppUserPreferences preferences);
public void Delete(AppUser user);
Task<AppUser> GetUserByUsernameAsync(string username);
+ Task<int> GetUserIdByUsernameAsync(string username);
+ Task<AppUser> GetUserWithReadingListsByUsernameAsync(string username);
Task<AppUser> GetUserByIdAsync(int id);
Task<IEnumerable<MemberDto>> GetMembersAsync();
Task<IEnumerable<AppUser>> GetAdminUsersAsync();
diff --git a/API/Interfaces/IVolumeRepository.cs b/API/Interfaces/Repositories/IVolumeRepository.cs
similarity index 94%
rename from API/Interfaces/IVolumeRepository.cs
rename to API/Interfaces/Repositories/IVolumeRepository.cs
index 0cd703ee9..e621b643c 100644
--- a/API/Interfaces/IVolumeRepository.cs
+++ b/API/Interfaces/Repositories/IVolumeRepository.cs
@@ -3,7 +3,7 @@ using System.Threading.Tasks;
using API.DTOs;
using API.Entities;
-namespace API.Interfaces
+namespace API.Interfaces.Repositories
{
public interface IVolumeRepository
{
diff --git a/API/Parser/Parser.cs b/API/Parser/Parser.cs
index b7b4ee8eb..98290dccf 100644
--- a/API/Parser/Parser.cs
+++ b/API/Parser/Parser.cs
@@ -129,9 +129,14 @@ namespace API.Parser
RegexTimeout),
// [dmntsf.net] One Piece - Digital Colored Comics Vol. 20 Ch. 177 - 30 Million vs 81 Million.cbz
new Regex(
- @"(?<Series>.*) (\b|_|-)(vol)\.?",
+ @"(?<Series>.*) (\b|_|-)(vol)\.?(\s|-|_)?\d+",
RegexOptions.IgnoreCase | RegexOptions.Compiled,
RegexTimeout),
+ // [xPearse] Kyochuu Rettou Volume 1 [English] [Manga] [Volume Scans]
+ new Regex(
+ @"(?<Series>.*) (\b|_|-)(vol)(ume)",
+ RegexOptions.IgnoreCase | RegexOptions.Compiled,
+ RegexTimeout),
//Knights of Sidonia c000 (S2 LE BD Omake - BLAME!) [Habanero Scans]
new Regex(
@"(?<Series>.*)(\bc\d+\b)",
diff --git a/API/Services/TaskScheduler.cs b/API/Services/TaskScheduler.cs
index f12926c68..aebaf665c 100644
--- a/API/Services/TaskScheduler.cs
+++ b/API/Services/TaskScheduler.cs
@@ -161,6 +161,7 @@ namespace API.Services
/// <summary>
/// Not an external call. Only public so that we can call this for a Task
/// </summary>
+ // ReSharper disable once MemberCanBePrivate.Global
public async Task CheckForUpdate()
{
var update = await _versionUpdaterService.CheckForUpdate();
diff --git a/UI/Web/package-lock.json b/UI/Web/package-lock.json
index 9f8f3aafa..408f8d920 100644
--- a/UI/Web/package-lock.json
+++ b/UI/Web/package-lock.json
@@ -245,6 +245,28 @@
"tslib": "^2.0.0"
}
},
+ "@angular/cdk": {
+ "version": "12.2.3",
+ "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-12.2.3.tgz",
+ "integrity": "sha512-ahY3k5X3eoQlsCX/fYiwbe1z7nfmwY15EiLpcJ8YrnUoB+ZshPm8qFIZi6gwY4tsMmUN8OfsIGcUO701bdxFpg==",
+ "requires": {
+ "parse5": "^5.0.0",
+ "tslib": "^2.2.0"
+ },
+ "dependencies": {
+ "parse5": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz",
+ "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==",
+ "optional": true
+ },
+ "tslib": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
+ "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
+ }
+ }
+ },
"@angular/cli": {
"version": "11.2.11",
"resolved": "https://registry.npmjs.org/@angular/cli/-/cli-11.2.11.tgz",
diff --git a/UI/Web/package.json b/UI/Web/package.json
index 42caf67ec..ba19d7e47 100644
--- a/UI/Web/package.json
+++ b/UI/Web/package.json
@@ -17,6 +17,7 @@
"dependencies": {
"@angular-slider/ngx-slider": "^2.0.3",
"@angular/animations": "~11.0.0",
+ "@angular/cdk": "^12.2.3",
"@angular/common": "~11.0.0",
"@angular/compiler": "~11.0.0",
"@angular/core": "~11.0.0",
diff --git a/UI/Web/src/app/_models/reading-list.ts b/UI/Web/src/app/_models/reading-list.ts
new file mode 100644
index 000000000..ad1a325b8
--- /dev/null
+++ b/UI/Web/src/app/_models/reading-list.ts
@@ -0,0 +1,23 @@
+import { MangaFormat } from "./manga-format";
+
+export interface ReadingListItem {
+ pagesRead: number;
+ pagesTotal: number;
+ seriesName: string;
+ seriesFormat: MangaFormat;
+ seriesId: number;
+ chapterId: number;
+ order: number;
+ chapterNumber: string;
+ volumeNumber: string;
+ libraryId: number;
+ id: number;
+}
+
+export interface ReadingList {
+ id: number;
+ title: string;
+ summary: string;
+ promoted: boolean;
+ items: Array<ReadingListItem>;
+}
\ No newline at end of file
diff --git a/UI/Web/src/app/_services/action-factory.service.ts b/UI/Web/src/app/_services/action-factory.service.ts
index 1640644da..a66c74a59 100644
--- a/UI/Web/src/app/_services/action-factory.service.ts
+++ b/UI/Web/src/app/_services/action-factory.service.ts
@@ -3,6 +3,7 @@ import { Chapter } from '../_models/chapter';
import { CollectionTag } from '../_models/collection-tag';
import { Library } from '../_models/library';
import { MangaFormat } from '../_models/manga-format';
+import { ReadingList } from '../_models/reading-list';
import { Series } from '../_models/series';
import { Volume } from '../_models/volume';
import { AccountService } from './account.service';
@@ -17,7 +18,8 @@ export enum Action {
RefreshMetadata = 6,
Download = 7,
Bookmarks = 8,
- IncognitoRead = 9
+ IncognitoRead = 9,
+ AddToReadingList = 10
}
export interface ActionItem<T> {
@@ -42,6 +44,8 @@ export class ActionFactoryService {
collectionTagActions: Array<ActionItem<CollectionTag>> = [];
+ readingListActions: Array<ActionItem<ReadingList>> = [];
+
isAdmin = false;
hasDownloadRole = false;
@@ -113,6 +117,13 @@ export class ActionFactoryService {
callback: this.dummyCallback,
requiresAdmin: false
});
+
+ // this.readingListActions.push({
+ // action: Action.Promote, // Should I just use CollectionTag modal-like instead?
+ // title: 'Delete',
+ // callback: this.dummyCallback,
+ // requiresAdmin: true
+ // });
}
if (this.hasDownloadRole || this.isAdmin) {
@@ -158,6 +169,11 @@ export class ActionFactoryService {
return this.collectionTagActions;
}
+ getReadingListActions(callback: (action: Action, readingList: ReadingList) => void) {
+ this.readingListActions.forEach(action => action.callback = callback);
+ return this.readingListActions;
+ }
+
filterBookmarksForFormat(action: ActionItem<Series>, series: Series) {
if (action.action === Action.Bookmarks && series?.format === MangaFormat.EPUB) return false;
return true;
@@ -188,7 +204,13 @@ export class ActionFactoryService {
title: 'Bookmarks',
callback: this.dummyCallback,
requiresAdmin: false
- }
+ },
+ {
+ action: Action.AddToReadingList,
+ title: 'Add to Reading List',
+ callback: this.dummyCallback,
+ requiresAdmin: false
+ },
];
this.volumeActions = [
@@ -204,6 +226,12 @@ export class ActionFactoryService {
callback: this.dummyCallback,
requiresAdmin: false
},
+ {
+ action: Action.AddToReadingList,
+ title: 'Add to Reading List',
+ callback: this.dummyCallback,
+ requiresAdmin: false
+ },
{
action: Action.IncognitoRead,
title: 'Read in Incognito',
@@ -232,8 +260,23 @@ export class ActionFactoryService {
requiresAdmin: false
},
{
- action: Action.IncognitoRead,
- title: 'Read in Incognito',
+ action: Action.AddToReadingList,
+ title: 'Add to Reading List',
+ callback: this.dummyCallback,
+ requiresAdmin: false
+ },
+ ];
+
+ this.readingListActions = [
+ {
+ action: Action.Edit,
+ title: 'Edit',
+ callback: this.dummyCallback,
+ requiresAdmin: false
+ },
+ {
+ action: Action.Delete,
+ title: 'Delete',
callback: this.dummyCallback,
requiresAdmin: false
},
diff --git a/UI/Web/src/app/_services/action.service.ts b/UI/Web/src/app/_services/action.service.ts
index b336e5733..b36ac1aa9 100644
--- a/UI/Web/src/app/_services/action.service.ts
+++ b/UI/Web/src/app/_services/action.service.ts
@@ -4,8 +4,11 @@ import { ToastrService } from 'ngx-toastr';
import { forkJoin, Subject } from 'rxjs';
import { take, takeUntil } from 'rxjs/operators';
import { BookmarksModalComponent } from '../cards/_modals/bookmarks-modal/bookmarks-modal.component';
+import { AddToListModalComponent, ADD_FLOW } from '../reading-list/_modals/add-to-list-modal/add-to-list-modal.component';
+import { EditReadingListModalComponent } from '../reading-list/_modals/edit-reading-list-modal/edit-reading-list-modal.component';
import { Chapter } from '../_models/chapter';
import { Library } from '../_models/library';
+import { ReadingList } from '../_models/reading-list';
import { Series } from '../_models/series';
import { Volume } from '../_models/volume';
import { LibraryService } from './library.service';
@@ -16,6 +19,7 @@ export type LibraryActionCallback = (library: Partial<Library>) => void;
export type SeriesActionCallback = (series: Series) => void;
export type VolumeActionCallback = (volume: Volume) => void;
export type ChapterActionCallback = (chapter: Chapter) => void;
+export type ReadingListActionCallback = (readingList: ReadingList) => void;
/**
* Responsible for executing actions
@@ -27,6 +31,7 @@ export class ActionService implements OnDestroy {
private readonly onDestroy = new Subject<void>();
private bookmarkModalRef: NgbModalRef | null = null;
+ private readingListModalRef: NgbModalRef | null = null;
constructor(private libraryService: LibraryService, private seriesService: SeriesService,
private readerService: ReaderService, private toastr: ToastrService, private modalService: NgbModal) { }
@@ -217,4 +222,85 @@ export class ActionService implements OnDestroy {
});
}
+ addSeriesToReadingList(series: Series, callback?: SeriesActionCallback) {
+ if (this.readingListModalRef != null) { return; }
+ this.readingListModalRef = this.modalService.open(AddToListModalComponent, { scrollable: true, size: 'md' });
+ this.readingListModalRef.componentInstance.seriesId = series.id;
+ this.readingListModalRef.componentInstance.title = series.name;
+ this.readingListModalRef.componentInstance.type = ADD_FLOW.Series;
+
+
+ this.readingListModalRef.closed.pipe(take(1)).subscribe(() => {
+ this.readingListModalRef = null;
+ if (callback) {
+ callback(series);
+ }
+ });
+ this.readingListModalRef.dismissed.pipe(take(1)).subscribe(() => {
+ this.readingListModalRef = null;
+ if (callback) {
+ callback(series);
+ }
+ });
+ }
+
+ addVolumeToReadingList(volume: Volume, seriesId: number, callback?: VolumeActionCallback) {
+ if (this.readingListModalRef != null) { return; }
+ this.readingListModalRef = this.modalService.open(AddToListModalComponent, { scrollable: true, size: 'md' });
+ this.readingListModalRef.componentInstance.seriesId = seriesId;
+ this.readingListModalRef.componentInstance.volumeId = volume.id;
+ this.readingListModalRef.componentInstance.type = ADD_FLOW.Volume;
+
+
+ this.readingListModalRef.closed.pipe(take(1)).subscribe(() => {
+ this.readingListModalRef = null;
+ if (callback) {
+ callback(volume);
+ }
+ });
+ this.readingListModalRef.dismissed.pipe(take(1)).subscribe(() => {
+ this.readingListModalRef = null;
+ if (callback) {
+ callback(volume);
+ }
+ });
+ }
+
+ addChapterToReadingList(chapter: Chapter, seriesId: number, callback?: ChapterActionCallback) {
+ if (this.readingListModalRef != null) { return; }
+ this.readingListModalRef = this.modalService.open(AddToListModalComponent, { scrollable: true, size: 'md' });
+ this.readingListModalRef.componentInstance.seriesId = seriesId;
+ this.readingListModalRef.componentInstance.chapterId = chapter.id;
+ this.readingListModalRef.componentInstance.type = ADD_FLOW.Chapter;
+
+
+ this.readingListModalRef.closed.pipe(take(1)).subscribe(() => {
+ this.readingListModalRef = null;
+ if (callback) {
+ callback(chapter);
+ }
+ });
+ this.readingListModalRef.dismissed.pipe(take(1)).subscribe(() => {
+ this.readingListModalRef = null;
+ if (callback) {
+ callback(chapter);
+ }
+ });
+ }
+
+ editReadingList(readingList: ReadingList, callback?: ReadingListActionCallback) {
+ const readingListModalRef = this.modalService.open(EditReadingListModalComponent, { scrollable: true, size: 'md' });
+ readingListModalRef.componentInstance.readingList = readingList;
+ readingListModalRef.closed.pipe(take(1)).subscribe((list) => {
+ if (callback && list !== undefined) {
+ callback(readingList);
+ }
+ });
+ readingListModalRef.dismissed.pipe(take(1)).subscribe((list) => {
+ if (callback && list !== undefined) {
+ callback(readingList);
+ }
+ });
+ }
+
}
diff --git a/UI/Web/src/app/_services/reader.service.ts b/UI/Web/src/app/_services/reader.service.ts
index 450c89a8f..3ad5f8724 100644
--- a/UI/Web/src/app/_services/reader.service.ts
+++ b/UI/Web/src/app/_services/reader.service.ts
@@ -1,6 +1,5 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
-import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { ChapterInfo } from '../manga-reader/_models/chapter-info';
import { UtilityService } from '../shared/_services/utility.service';
@@ -73,17 +72,23 @@ export class ReaderService {
return this.httpClient.post(this.baseUrl + 'reader/mark-volume-unread', {seriesId, volumeId});
}
- getNextChapter(seriesId: number, volumeId: number, currentChapterId: number) {
+ getNextChapter(seriesId: number, volumeId: number, currentChapterId: number, readingListId: number = -1) {
+ if (readingListId > 0) {
+ return this.httpClient.get<number>(this.baseUrl + 'readinglist/next-chapter?seriesId=' + seriesId + '&currentChapterId=' + currentChapterId + '&readingListId=' + readingListId);
+ }
return this.httpClient.get<number>(this.baseUrl + 'reader/next-chapter?seriesId=' + seriesId + '&volumeId=' + volumeId + '&currentChapterId=' + currentChapterId);
}
- getPrevChapter(seriesId: number, volumeId: number, currentChapterId: number) {
+ getPrevChapter(seriesId: number, volumeId: number, currentChapterId: number, readingListId: number = -1) {
+ if (readingListId > 0) {
+ return this.httpClient.get<number>(this.baseUrl + 'readinglist/prev-chapter?seriesId=' + seriesId + '&currentChapterId=' + currentChapterId + '&readingListId=' + readingListId);
+ }
return this.httpClient.get<number>(this.baseUrl + 'reader/prev-chapter?seriesId=' + seriesId + '&volumeId=' + volumeId + '&currentChapterId=' + currentChapterId);
}
getCurrentChapter(volumes: Array<Volume>): Chapter {
let currentlyReadingChapter: Chapter | undefined = undefined;
- const chapters = volumes.filter(v => v.number !== 0).map(v => v.chapters || []).flat().sort(this.utilityService.sortChapters); // changed from === 0 to != 0
+ const chapters = volumes.filter(v => v.number !== 0).map(v => v.chapters || []).flat().sort(this.utilityService.sortChapters);
for (const c of chapters) {
if (c.pagesRead < c.pages) {
@@ -137,4 +142,37 @@ export class ReaderService {
if (imageSrc === undefined || imageSrc === '') { return -1; }
return parseInt(imageSrc.split('&page=')[1], 10);
}
+
+ getNextChapterUrl(url: string, nextChapterId: number, incognitoMode: boolean = false, readingListMode: boolean = false, readingListId: number = -1) {
+ const lastSlashIndex = url.lastIndexOf('/');
+ let newRoute = url.substring(0, lastSlashIndex + 1) + nextChapterId + '';
+ newRoute += this.getQueryParams(incognitoMode, readingListMode, readingListId);
+ return newRoute;
+ }
+
+ getQueryParamsObject(incognitoMode: boolean = false, readingListMode: boolean = false, readingListId: number = -1) {
+ let params: {[key: string]: any} = {};
+ if (incognitoMode) {
+ params['incognitoMode'] = true;
+ }
+ if (readingListMode) {
+ params['readingListId'] = readingListId;
+ }
+ return params;
+ }
+
+ getQueryParams(incognitoMode: boolean = false, readingListMode: boolean = false, readingListId: number = -1) {
+ let params = '';
+ if (incognitoMode) {
+ params += '?incognitoMode=true';
+ }
+ if (readingListMode) {
+ if (params.indexOf('?') > 0) {
+ params += '&readingListId=' + readingListId;
+ } else {
+ params += '?readingListId=' + readingListId;
+ }
+ }
+ return params;
+ }
}
diff --git a/UI/Web/src/app/_services/reading-list.service.ts b/UI/Web/src/app/_services/reading-list.service.ts
new file mode 100644
index 000000000..f7b3343d7
--- /dev/null
+++ b/UI/Web/src/app/_services/reading-list.service.ts
@@ -0,0 +1,102 @@
+import { HttpClient, HttpParams } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+import { map } from 'rxjs/operators';
+import { environment } from 'src/environments/environment';
+import { PaginatedResult } from '../_models/pagination';
+import { ReadingList, ReadingListItem } from '../_models/reading-list';
+import { ActionItem } from './action-factory.service';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class ReadingListService {
+
+ baseUrl = environment.apiUrl;
+
+ constructor(private httpClient: HttpClient) { }
+
+ getReadingList(readingListId: number) {
+ return this.httpClient.get<ReadingList>(this.baseUrl + 'readinglist?readingListId=' + readingListId);
+ }
+
+ getReadingLists(includePromoted: boolean = true, pageNum?: number, itemsPerPage?: number) {
+ let params = new HttpParams();
+ params = this._addPaginationIfExists(params, pageNum, itemsPerPage);
+
+ return this.httpClient.post<PaginatedResult<ReadingList[]>>(this.baseUrl + 'readinglist/lists?includePromoted=' + includePromoted, {}, {observe: 'response', params}).pipe(
+ map((response: any) => {
+ return this._cachePaginatedResults(response, new PaginatedResult<ReadingList[]>());
+ })
+ );
+ }
+
+ getListItems(readingListId: number) {
+ return this.httpClient.get<ReadingListItem[]>(this.baseUrl + 'readinglist/items?readingListId=' + readingListId);
+ }
+
+ createList(title: string) {
+ return this.httpClient.post<ReadingList>(this.baseUrl + 'readinglist/create', {title});
+ }
+
+ update(model: {readingListId: number, title?: string, summary?: string, promoted: boolean}) {
+ return this.httpClient.post(this.baseUrl + 'readinglist/update', model, { responseType: 'text' as 'json' });
+ }
+
+ updateBySeries(readingListId: number, seriesId: number) {
+ return this.httpClient.post(this.baseUrl + 'readinglist/update-by-series', {readingListId, seriesId}, { responseType: 'text' as 'json' });
+ }
+
+ updateByVolume(readingListId: number, seriesId: number, volumeId: number) {
+ return this.httpClient.post(this.baseUrl + 'readinglist/update-by-volume', {readingListId, seriesId, volumeId}, { responseType: 'text' as 'json' });
+ }
+
+ updateByChapter(readingListId: number, seriesId: number, chapterId: number) {
+ return this.httpClient.post(this.baseUrl + 'readinglist/update-by-chapter', {readingListId, seriesId, chapterId}, { responseType: 'text' as 'json' });
+ }
+
+ delete(readingListId: number) {
+ return this.httpClient.delete(this.baseUrl + 'readinglist?readingListId=' + readingListId, { responseType: 'text' as 'json' });
+ }
+
+ updatePosition(readingListId: number, readingListItemId: number, fromPosition: number, toPosition: number) {
+ return this.httpClient.post(this.baseUrl + 'readinglist/update-position', {readingListId, readingListItemId, fromPosition, toPosition}, { responseType: 'text' as 'json' });
+ }
+
+ deleteItem(readingListId: number, readingListItemId: number) {
+ return this.httpClient.post(this.baseUrl + 'readinglist/delete-item', {readingListId, readingListItemId}, { responseType: 'text' as 'json' });
+ }
+
+ removeRead(readingListId: number) {
+ return this.httpClient.post(this.baseUrl + 'readinglist/remove-read?readingListId=' + readingListId, { responseType: 'text' as 'json' });
+ }
+
+ actionListFilter(action: ActionItem<ReadingList>, readingList: ReadingList, isAdmin: boolean) {
+ if (readingList?.promoted && !isAdmin) return false;
+ return true;
+ }
+
+ _addPaginationIfExists(params: HttpParams, pageNum?: number, itemsPerPage?: number) {
+ // TODO: Move to utility service
+ if (pageNum !== null && pageNum !== undefined && itemsPerPage !== null && itemsPerPage !== undefined) {
+ params = params.append('pageNumber', pageNum + '');
+ params = params.append('pageSize', itemsPerPage + '');
+ }
+ return params;
+ }
+
+ _cachePaginatedResults(response: any, paginatedVariable: PaginatedResult<any[]>) {
+ // TODO: Move to utility service
+ if (response.body === null) {
+ paginatedVariable.result = [];
+ } else {
+ paginatedVariable.result = response.body;
+ }
+
+ const pageHeader = response.headers.get('Pagination');
+ if (pageHeader !== null) {
+ paginatedVariable.pagination = JSON.parse(pageHeader);
+ }
+
+ return paginatedVariable;
+ }
+}
diff --git a/UI/Web/src/app/admin/_modals/directory-picker/directory-picker.component.html b/UI/Web/src/app/admin/_modals/directory-picker/directory-picker.component.html
index 78440a06b..479107e0b 100644
--- a/UI/Web/src/app/admin/_modals/directory-picker/directory-picker.component.html
+++ b/UI/Web/src/app/admin/_modals/directory-picker/directory-picker.component.html
@@ -27,7 +27,7 @@
</li>
</ol>
<ng-template #noBreadcrumb>
- <div class="breadcrumb">Select a folder to view breadcrumb</div>
+ <div class="breadcrumb">Select a folder to view breadcrumb. Don't see your directory, try checking / first.</div>
</ng-template>
</nav>
<ul class="list-group">
@@ -50,5 +50,6 @@
</ul>
</div>
<div class="modal-footer">
+ <a class="btn btn-info" href="https://wiki.kavitareader.com/en/guides/adding-a-library" target="_blank">Help</a>
<button type="button" class="btn btn-secondary" (click)="close()">Cancel</button>
</div>
diff --git a/UI/Web/src/app/admin/_modals/library-editor-modal/library-editor-modal.component.ts b/UI/Web/src/app/admin/_modals/library-editor-modal/library-editor-modal.component.ts
index f1257aa8d..441a1ca2a 100644
--- a/UI/Web/src/app/admin/_modals/library-editor-modal/library-editor-modal.component.ts
+++ b/UI/Web/src/app/admin/_modals/library-editor-modal/library-editor-modal.component.ts
@@ -1,6 +1,7 @@
import { Component, Input, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap';
+import { ToastrService } from 'ngx-toastr';
import { Library } from 'src/app/_models/library';
import { LibraryService } from 'src/app/_services/library.service';
import { SettingsService } from '../../settings.service';
@@ -26,7 +27,8 @@ export class LibraryEditorModalComponent implements OnInit {
libraryTypes: string[] = []
- constructor(private modalService: NgbModal, private libraryService: LibraryService, public modal: NgbActiveModal, private settingService: SettingsService) { }
+ constructor(private modalService: NgbModal, private libraryService: LibraryService, public modal: NgbActiveModal, private settingService: SettingsService,
+ private toastr: ToastrService) { }
ngOnInit(): void {
@@ -64,6 +66,7 @@ export class LibraryEditorModalComponent implements OnInit {
model.folders = model.folders.map((item: string) => item.startsWith('\\') ? item.substr(1, item.length) : item);
model.type = parseInt(model.type, 10);
this.libraryService.create(model).subscribe(() => {
+ this.toastr.success('Library created, a scan has been started');
this.close(true);
}, err => {
this.errorMessage = err;
diff --git a/UI/Web/src/app/admin/dashboard/dashboard.component.html b/UI/Web/src/app/admin/dashboard/dashboard.component.html
index 26886dd7f..9b34f71f8 100644
--- a/UI/Web/src/app/admin/dashboard/dashboard.component.html
+++ b/UI/Web/src/app/admin/dashboard/dashboard.component.html
@@ -1,7 +1,7 @@
<div class="container">
<h2>Admin Dashboard</h2>
- <ul ngbNav #nav="ngbNav" [(activeId)]="active" class="nav-tabs">
+ <ul ngbNav #nav="ngbNav" [(activeId)]="active" class="nav-tabs nav-pills">
<li *ngFor="let tab of tabs" [ngbNavItem]="tab">
<a ngbNavLink routerLink="." [fragment]="tab.fragment">{{ tab.title | titlecase }}</a>
<ng-template ngbNavContent>
diff --git a/UI/Web/src/app/app-routing.module.ts b/UI/Web/src/app/app-routing.module.ts
index 21155ec75..e65fd5ee3 100644
--- a/UI/Web/src/app/app-routing.module.ts
+++ b/UI/Web/src/app/app-routing.module.ts
@@ -10,6 +10,8 @@ import { UserLoginComponent } from './user-login/user-login.component';
import { AuthGuard } from './_guards/auth.guard';
import { LibraryAccessGuard } from './_guards/library-access.guard';
import { InProgressComponent } from './in-progress/in-progress.component';
+import { DashboardComponent as AdminDashboardComponent } from './admin/dashboard/dashboard.component';
+import { DashboardComponent } from './dashboard/dashboard.component';
// TODO: Once we modularize the components, use this and measure performance impact: https://angular.io/guide/lazy-loading-ngmodules#preloading-modules
@@ -27,6 +29,10 @@ const routes: Routes = [
path: 'preferences',
loadChildren: () => import('./user-settings/user-settings.module').then(m => m.UserSettingsModule)
},
+ {
+ path: 'lists',
+ loadChildren: () => import('./reading-list/reading-list.module').then(m => m.ReadingListModule)
+ },
{
path: '',
runGuardsAndResolvers: 'always',
@@ -49,7 +55,7 @@ const routes: Routes = [
runGuardsAndResolvers: 'always',
canActivate: [AuthGuard],
children: [
- {path: 'library', component: LibraryComponent},
+ {path: 'library', component: DashboardComponent},
{path: 'recently-added', component: RecentlyAddedComponent},
{path: 'in-progress', component: InProgressComponent},
]
diff --git a/UI/Web/src/app/app.module.ts b/UI/Web/src/app/app.module.ts
index a8d5915a5..9a029e665 100644
--- a/UI/Web/src/app/app.module.ts
+++ b/UI/Web/src/app/app.module.ts
@@ -7,7 +7,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HomeComponent } from './home/home.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
-import { NgbAccordionModule, NgbDropdownModule, NgbNavModule, NgbPaginationModule, NgbRatingModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
+import { NgbDropdownModule, NgbNavModule, NgbPaginationModule, NgbRatingModule } from '@ng-bootstrap/ng-bootstrap';
import { NavHeaderComponent } from './nav-header/nav-header.component';
import { JwtInterceptor } from './_interceptors/jwt.interceptor';
import { UserLoginComponent } from './user-login/user-login.component';
@@ -21,7 +21,6 @@ import { NotConnectedComponent } from './not-connected/not-connected.component';
import { AutocompleteLibModule } from 'angular-ng-autocomplete';
import { ReviewSeriesModalComponent } from './_modals/review-series-modal/review-series-modal.component';
import { CarouselModule } from './carousel/carousel.module';
-import { NgxSliderModule } from '@angular-slider/ngx-slider';
import * as Sentry from '@sentry/angular';
@@ -33,11 +32,12 @@ import { Dedupe as DedupeIntegration } from '@sentry/integrations';
import { PersonBadgeComponent } from './person-badge/person-badge.component';
import { TypeaheadModule } from './typeahead/typeahead.module';
import { RecentlyAddedComponent } from './recently-added/recently-added.component';
-import { InProgressComponent } from './in-progress/in-progress.component';
import { CardsModule } from './cards/cards.module';
import { CollectionsModule } from './collections/collections.module';
-import { CommonModule } from '@angular/common';
+import { InProgressComponent } from './in-progress/in-progress.component';
import { SAVER, getSaver } from './shared/_providers/saver.provider';
+import { ReadingListModule } from './reading-list/reading-list.module';
+import { DashboardComponent } from './dashboard/dashboard.component';
let sentryProviders: any[] = [];
@@ -98,6 +98,7 @@ if (environment.production) {
PersonBadgeComponent,
RecentlyAddedComponent,
InProgressComponent,
+ DashboardComponent,
],
imports: [
HttpClientModule,
@@ -109,19 +110,16 @@ if (environment.production) {
NgbDropdownModule, // Nav
AutocompleteLibModule, // Nav
- //NgbTooltipModule, // Shared & SettingsModule
NgbRatingModule, // Series Detail
NgbNavModule,
- //NgbAccordionModule, // User Preferences
- //NgxSliderModule, // User Preference
NgbPaginationModule,
-
SharedModule,
CarouselModule,
TypeaheadModule,
CardsModule,
CollectionsModule,
+ ReadingListModule,
ToastrModule.forRoot({
positionClass: 'toast-bottom-right',
diff --git a/UI/Web/src/app/book-reader/_models/book-info.ts b/UI/Web/src/app/book-reader/_models/book-info.ts
new file mode 100644
index 000000000..4816bd324
--- /dev/null
+++ b/UI/Web/src/app/book-reader/_models/book-info.ts
@@ -0,0 +1,9 @@
+import { MangaFormat } from "src/app/_models/manga-format";
+
+export interface BookInfo {
+ bookTitle: string;
+ seriesFormat: MangaFormat;
+ seriesId: number;
+ libraryId: number;
+ volumeId: number;
+}
\ No newline at end of file
diff --git a/UI/Web/src/app/book-reader/book-reader/book-reader.component.html b/UI/Web/src/app/book-reader/book-reader/book-reader.component.html
index fb727f93f..eb96c4bc7 100644
--- a/UI/Web/src/app/book-reader/book-reader/book-reader.component.html
+++ b/UI/Web/src/app/book-reader/book-reader/book-reader.component.html
@@ -67,7 +67,7 @@
<div class="col-10" style="margin-top: 9px">
<ngb-progressbar style="cursor: pointer" title="Go to page" (click)="goToPage()" type="primary" height="5px" [value]="pageNum" [max]="maxPages - 1"></ngb-progressbar>
</div>
- <div class="col-1">{{maxPages - 1}}</div>
+ <div class="col-1 btn-icon" (click)="goToPage(maxPages - 1)" title="Go to last page">{{maxPages - 1}}</div>
</div>
<div class="table-of-contents">
<h3>Table of Contents</h3>
@@ -77,18 +77,18 @@
<div *ngIf="chapters.length === 1; else nestedChildren">
<ul>
<li *ngFor="let chapter of chapters[0].children">
- <a href="javascript:void(0);" (click)="loadChapter(chapter.page, chapter.part)">{{chapter.title}}</a>
+ <a href="javascript:void(0);" (click)="loadChapterPage(chapter.page, chapter.part)">{{chapter.title}}</a>
</li>
</ul>
</div>
<ng-template #nestedChildren>
<ul *ngFor="let chapterGroup of chapters" style="padding-inline-start: 0px">
- <li class="{{chapterGroup.page == pageNum ? 'active': ''}}" (click)="loadChapter(chapterGroup.page, '')">
+ <li class="{{chapterGroup.page == pageNum ? 'active': ''}}" (click)="loadChapterPage(chapterGroup.page, '')">
{{chapterGroup.title}}
</li>
<ul *ngFor="let chapter of chapterGroup.children">
<li class="{{cleanIdSelector(chapter.part) === currentPageAnchor ? 'active' : ''}}">
- <a href="javascript:void(0);" (click)="loadChapter(chapter.page, chapter.part)">{{chapter.title}}</a>
+ <a href="javascript:void(0);" (click)="loadChapterPage(chapter.page, chapter.part)">{{chapter.title}}</a>
</li>
</ul>
</ul>
@@ -122,12 +122,22 @@
<ng-template #actionBar>
<div class="reading-bar row no-gutters justify-content-between">
- <button class="btn btn-outline-secondary btn-icon col-2 col-xs-1" (click)="prevPage()" [disabled]="readingDirection === 0 ? pageNum === 0 : pageNum + 1 >= maxPages - 1" title="{{readingDirection === 0 ? 'Previous' : 'Next'}} Page"><i class="fa fa-arrow-left" aria-hidden="true"></i><span class="phone-hidden">&nbsp;{{readingDirection === 0 ? 'Previous' : 'Next'}}</span></button>
+ <button class="btn btn-outline-secondary btn-icon col-2 col-xs-1" (click)="prevPage()"
+ [disabled]="IsPrevDisabled"
+ title="{{readingDirection === ReadingDirection.LeftToRight ? 'Previous' : 'Next'}} Page">
+ <i class="fa {{(readingDirection === ReadingDirection.LeftToRight ? pageNum === 0 : pageNum + 1 >= maxPages - 1) ? 'fa-angle-double-left' : 'fa-angle-left'}}" aria-hidden="true"></i>
+ <span class="phone-hidden">&nbsp;{{readingDirection === ReadingDirection.LeftToRight ? 'Previous' : 'Next'}}</span>
+ </button>
<button *ngIf="!this.adhocPageHistory.isEmpty()" class="btn btn-outline-secondary btn-icon col-2 col-xs-1" (click)="goBack()" title="Go Back"><i class="fa fa-reply" aria-hidden="true"></i><span class="phone-hidden">&nbsp;Go Back</span></button>
<button class="btn btn-secondary col-2 col-xs-1" (click)="toggleDrawer()"><i class="fa fa-bars" aria-hidden="true"></i><span class="phone-hidden">&nbsp;Settings</span></button>
- <div class="book-title col-2 phone-hidden">{{bookTitle}} </div>
+ <div class="book-title col-2 phone-hidden">{{bookTitle}} <span *ngIf="incognitoMode">(<i class="fa fa-glasses" aria-hidden="true"></i><span class="sr-only">Incognito Mode</span>)</span></div>
<button class="btn btn-secondary col-2 col-xs-1" (click)="closeReader()"><i class="fa fa-times-circle" aria-hidden="true"></i><span class="phone-hidden">&nbsp;Close</span></button>
- <button class="btn btn-outline-secondary btn-icon col-2 col-xs-1" [disabled]="readingDirection === 0 ? pageNum + 1 >= maxPages - 1 : pageNum === 0" (click)="nextPage()" title="{{readingDirection === 0 ? 'Next' : 'Previous'}} Page"><span class="phone-hidden">{{readingDirection === 0 ? 'Next' : 'Previous'}}&nbsp;</span><i class="fa fa-arrow-right" aria-hidden="true"></i></button>
+ <button class="btn btn-outline-secondary btn-icon col-2 col-xs-1"
+ [disabled]="IsNextDisabled"
+ (click)="nextPage()" title="{{readingDirection === ReadingDirection.LeftToRight ? 'Next' : 'Previous'}} Page">
+ <span class="phone-hidden">{{readingDirection === ReadingDirection.LeftToRight ? 'Next' : 'Previous'}}&nbsp;</span>
+ <i class="fa {{(readingDirection === ReadingDirection.LeftToRight ? pageNum + 1 >= maxPages - 1 : pageNum === 0) ? 'fa-angle-double-right' : 'fa-angle-right'}}" aria-hidden="true"></i>
+ </button>
</div>
</ng-template>
diff --git a/UI/Web/src/app/book-reader/book-reader/book-reader.component.ts b/UI/Web/src/app/book-reader/book-reader/book-reader.component.ts
index 51d5fbfeb..c37993c2d 100644
--- a/UI/Web/src/app/book-reader/book-reader/book-reader.component.ts
+++ b/UI/Web/src/app/book-reader/book-reader/book-reader.component.ts
@@ -22,6 +22,7 @@ import { Preferences } from 'src/app/_models/preferences/preferences';
import { MemberService } from 'src/app/_services/member.service';
import { ReadingDirection } from 'src/app/_models/preferences/reading-direction';
import { ScrollService } from 'src/app/scroll.service';
+import { MangaFormat } from 'src/app/_models/manga-format';
interface PageStyle {
@@ -38,7 +39,8 @@ interface HistoryPoint {
}
const TOP_OFFSET = -50 * 1.5; // px the sticky header takes up
-const SCROLL_PART_TIMEOUT = 5000;
+const CHAPTER_ID_NOT_FETCHED = -2;
+const CHAPTER_ID_DOESNT_EXIST = -1;
@Component({
selector: 'app-book-reader',
@@ -65,15 +67,30 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
chapterId!: number;
chapter!: Chapter;
/**
- * If we should save progress or not
+ * Reading List id. Defaults to -1.
*/
+ readingListId: number = CHAPTER_ID_DOESNT_EXIST;
+
+ /**
+ * If this is true, no progress will be saved.
+ */
incognitoMode: boolean = false;
+
+ /**
+ * If this is true, chapters will be fetched in the order of a reading list, rather than natural series order.
+ */
+ readingListMode: boolean = false;
chapters: Array<BookChapterItem> = [];
pageNum = 0;
maxPages = 1;
adhocPageHistory: Stack<HistoryPoint> = new Stack<HistoryPoint>();
+ /**
+ * A stack of the chapter ids we come across during continuous reading mode. When we traverse a boundary, we use this to avoid extra API calls.
+ * @see Stack
+ */
+ continuousChaptersStack: Stack<number> = new Stack();
user!: User;
@@ -94,6 +111,38 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild('readingSection', {static: false}) readingSectionElemRef!: ElementRef<HTMLDivElement>;
@ViewChild('stickyTop', {static: false}) stickyTopElemRef!: ElementRef<HTMLDivElement>;
+ /**
+ * Next Chapter Id. This is not garunteed to be a valid ChapterId. Prefetched on page load (non-blocking).
+ */
+ nextChapterId: number = CHAPTER_ID_NOT_FETCHED;
+ /**
+ * Previous Chapter Id. This is not garunteed to be a valid ChapterId. Prefetched on page load (non-blocking).
+ */
+ prevChapterId: number = CHAPTER_ID_NOT_FETCHED;
+ /**
+ * Is there a next chapter. If not, this will disable UI controls.
+ */
+ nextChapterDisabled: boolean = false;
+ /**
+ * Is there a previous chapter. If not, this will disable UI controls.
+ */
+ prevChapterDisabled: boolean = false;
+ /**
+ * Has the next chapter been prefetched. Prefetched means the backend will cache the files.
+ */
+ nextChapterPrefetched: boolean = false;
+ /**
+ * Has the previous chapter been prefetched. Prefetched means the backend will cache the files.
+ */
+ prevChapterPrefetched: boolean = false;
+ /**
+ * If the prev page allows a page change to occur.
+ */
+ prevPageDisabled = false;
+ /**
+ * If the next page allows a page change to occur.
+ */
+ nextPageDisabled = false;
/**
* Internal property used to capture all the different css properties to render on all elements
@@ -122,6 +171,9 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
* Last seen progress part path
*/
lastSeenScrollPartPath: string = '';
+
+
+
/**
* Hack: Override background color for reader and restore it onDestroy
*/
@@ -151,6 +203,24 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
}
`;
+ get ReadingDirection(): typeof ReadingDirection {
+ return ReadingDirection;
+ }
+
+ get IsPrevDisabled() {
+ if (this.readingDirection === ReadingDirection.LeftToRight) {
+ return this.prevPageDisabled && this.pageNum === 0;
+ }
+ return this.nextPageDisabled && this.pageNum + 1 >= this.maxPages - 1;
+ }
+
+ get IsNextDisabled() {
+ if (this.readingDirection === ReadingDirection.LeftToRight) {
+ this.nextPageDisabled && this.pageNum + 1 >= this.maxPages - 1;
+ }
+ return this.prevPageDisabled && this.pageNum === 0;
+ }
+
constructor(private route: ActivatedRoute, private router: Router, private accountService: AccountService,
private seriesService: SeriesService, private readerService: ReaderService, private location: Location,
private renderer: Renderer2, private navService: NavService, private toastr: ToastrService,
@@ -274,6 +344,13 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.chapterId = parseInt(chapterId, 10);
this.incognitoMode = this.route.snapshot.queryParamMap.get('incognitoMode') === 'true';
+ const readingListId = this.route.snapshot.queryParamMap.get('readingListId');
+ if (readingListId != null) {
+ this.readingListMode = true;
+ this.readingListId = parseInt(readingListId, 10);
+ }
+
+
this.memberService.hasReadingProgress(this.libraryId).pipe(take(1)).subscribe(hasProgress => {
if (!hasProgress) {
this.toggleDrawer();
@@ -281,34 +358,71 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
}
});
- forkJoin({
- chapter: this.seriesService.getChapter(this.chapterId),
- progress: this.readerService.getProgress(this.chapterId),
- chapters: this.bookService.getBookChapters(this.chapterId),
- info: this.bookService.getBookInfo(this.chapterId)
- }).pipe(take(1)).subscribe(results => {
- this.chapter = results.chapter;
- this.volumeId = results.chapter.volumeId;
- this.maxPages = results.chapter.pages;
- this.chapters = results.chapters;
- this.pageNum = results.progress.pageNum;
- this.bookTitle = results.info;
-
-
- if (this.pageNum >= this.maxPages) {
- this.pageNum = this.maxPages - 1;
- if (!this.incognitoMode) {
- this.readerService.saveProgress(this.seriesId, this.volumeId, this.chapterId, this.pageNum).pipe(take(1)).subscribe(() => {/* No operation */});
- }
+ this.init();
+ }
+
+ init() {
+ this.nextChapterId = CHAPTER_ID_NOT_FETCHED;
+ this.prevChapterId = CHAPTER_ID_NOT_FETCHED;
+ this.nextChapterDisabled = false;
+ this.prevChapterDisabled = false;
+ this.nextChapterPrefetched = false;
+
+ this.bookService.getBookInfo(this.chapterId).subscribe(info => {
+ this.bookTitle = info.bookTitle;
+
+ if (this.readingListMode && info.seriesFormat !== MangaFormat.EPUB) {
+ // Redirect to the manga reader.
+ const params = this.readerService.getQueryParamsObject(this.incognitoMode, this.readingListMode, this.readingListId);
+ this.router.navigate(['library', info.libraryId, 'series', info.seriesId, 'manga', this.chapterId], {queryParams: params});
+ return;
}
- // Check if user progress has part, if so load it so we scroll to it
- this.loadPage(results.progress.bookScrollId || undefined);
- }, () => {
- setTimeout(() => {
- this.closeReader();
- }, 200);
+ forkJoin({
+ chapter: this.seriesService.getChapter(this.chapterId),
+ progress: this.readerService.getProgress(this.chapterId),
+ chapters: this.bookService.getBookChapters(this.chapterId),
+ }).pipe(take(1)).subscribe(results => {
+ this.chapter = results.chapter;
+ this.volumeId = results.chapter.volumeId;
+ this.maxPages = results.chapter.pages;
+ this.chapters = results.chapters;
+ this.pageNum = results.progress.pageNum;
+
+
+ this.continuousChaptersStack.push(this.chapterId);
+
+
+ if (this.pageNum >= this.maxPages) {
+ this.pageNum = this.maxPages - 1;
+ if (!this.incognitoMode) {
+ this.readerService.saveProgress(this.seriesId, this.volumeId, this.chapterId, this.pageNum).pipe(take(1)).subscribe(() => {/* No operation */});
+ }
+ }
+
+ this.readerService.getNextChapter(this.seriesId, this.volumeId, this.chapterId, this.readingListId).pipe(take(1)).subscribe(chapterId => {
+ this.nextChapterId = chapterId;
+ if (chapterId === CHAPTER_ID_DOESNT_EXIST || chapterId === this.chapterId) {
+ this.nextChapterDisabled = true;
+ }
+ });
+ this.readerService.getPrevChapter(this.seriesId, this.volumeId, this.chapterId, this.readingListId).pipe(take(1)).subscribe(chapterId => {
+ this.prevChapterId = chapterId;
+ if (chapterId === CHAPTER_ID_DOESNT_EXIST || chapterId === this.chapterId) {
+ this.prevChapterDisabled = true;
+ }
+ });
+
+ // Check if user progress has part, if so load it so we scroll to it
+ this.loadPage(results.progress.bookScrollId || undefined);
+ }, () => {
+ setTimeout(() => {
+ this.closeReader();
+ }, 200);
+ });
});
+
+
}
@HostListener('window:keydown', ['$event'])
@@ -353,7 +467,63 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
}
}
- loadChapter(pageNum: number, part: string) {
+ loadNextChapter() {
+ if (this.nextPageDisabled) { return; }
+ this.isLoading = true;
+ if (this.nextChapterId === CHAPTER_ID_NOT_FETCHED || this.nextChapterId === this.chapterId) {
+ this.readerService.getNextChapter(this.seriesId, this.volumeId, this.chapterId, this.readingListId).pipe(take(1)).subscribe(chapterId => {
+ this.nextChapterId = chapterId;
+ this.loadChapter(chapterId, 'next');
+ });
+ } else {
+ this.loadChapter(this.nextChapterId, 'next');
+ }
+ }
+
+ loadPrevChapter() {
+ if (this.prevPageDisabled) { return; }
+ this.isLoading = true;
+ this.continuousChaptersStack.pop();
+ const prevChapter = this.continuousChaptersStack.peek();
+ if (prevChapter != this.chapterId) {
+ if (prevChapter !== undefined) {
+ this.chapterId = prevChapter;
+ this.init();
+ return;
+ }
+ }
+
+ if (this.prevChapterId === CHAPTER_ID_NOT_FETCHED || this.prevChapterId === this.chapterId) {
+ this.readerService.getPrevChapter(this.seriesId, this.volumeId, this.chapterId, this.readingListId).pipe(take(1)).subscribe(chapterId => {
+ this.prevChapterId = chapterId;
+ this.loadChapter(chapterId, 'prev');
+ });
+ } else {
+ this.loadChapter(this.prevChapterId, 'prev');
+ }
+ }
+
+ loadChapter(chapterId: number, direction: 'next' | 'prev') {
+ if (chapterId >= 0) {
+ this.chapterId = chapterId;
+ this.continuousChaptersStack.push(chapterId);
+ // Load chapter Id onto route but don't reload
+ const newRoute = this.readerService.getNextChapterUrl(this.router.url, this.chapterId, this.incognitoMode, this.readingListMode, this.readingListId);
+ window.history.replaceState({}, '', newRoute);
+ this.init();
+ } else {
+ // This will only happen if no actual chapter can be found
+ this.toastr.warning('Could not find ' + direction + ' chapter');
+ this.isLoading = false;
+ if (direction === 'prev') {
+ this.prevPageDisabled = true;
+ } else {
+ this.nextPageDisabled = true;
+ }
+ }
+ }
+
+ loadChapterPage(pageNum: number, part: string) {
this.setPageNum(pageNum);
this.loadPage('id("' + part + '")');
}
@@ -572,7 +742,14 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.setPageNum(this.pageNum + 1);
}
+ if (oldPageNum === 0) {
+ // Move to next volume/chapter automatically
+ this.loadPrevChapter();
+ return;
+ }
+
if (oldPageNum === this.pageNum) { return; }
+
this.loadPage();
}
@@ -588,7 +765,12 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
} else {
this.setPageNum(this.pageNum - 1);
}
-
+
+ if (this.pageNum >= this.maxPages - 1) {
+ // Move to next volume/chapter automatically
+ this.loadNextChapter();
+ }
+
if (oldPageNum === this.pageNum) { return; }
this.loadPage();
diff --git a/UI/Web/src/app/book-reader/book.service.ts b/UI/Web/src/app/book-reader/book.service.ts
index d3d650600..bef4ce73d 100644
--- a/UI/Web/src/app/book-reader/book.service.ts
+++ b/UI/Web/src/app/book-reader/book.service.ts
@@ -2,6 +2,7 @@ import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';
import { BookChapterItem } from './_models/book-chapter-item';
+import { BookInfo } from './_models/book-info';
export interface BookPage {
bookTitle: string;
@@ -32,7 +33,7 @@ export class BookService {
}
getBookInfo(chapterId: number) {
- return this.http.get<string>(this.baseUrl + 'book/' + chapterId + '/book-info', {responseType: 'text' as 'json'});
+ return this.http.get<BookInfo>(this.baseUrl + 'book/' + chapterId + '/book-info');
}
getBookPageUrl(chapterId: number, page: number) {
diff --git a/UI/Web/src/app/cards/_modals/card-details-modal/card-details-modal.component.html b/UI/Web/src/app/cards/_modals/card-details-modal/card-details-modal.component.html
index 4542f7938..d18987f6b 100644
--- a/UI/Web/src/app/cards/_modals/card-details-modal/card-details-modal.component.html
+++ b/UI/Web/src/app/cards/_modals/card-details-modal/card-details-modal.component.html
@@ -37,8 +37,8 @@
<h5 class="mt-0 mb-1">
<span *ngIf="chapter.number !== '0'; else specialHeader">
<span class="">
- <app-card-actionables (actionHandler)="performAction($event, chapter)" [actions]="chapterActions" [labelBy]="'Chapter' + formatChapterNumber(chapter)"></app-card-actionables>
- </span>&nbsp;Chapter {{formatChapterNumber(chapter)}}
+ <app-card-actionables (actionHandler)="performAction($event, chapter)" [actions]="chapterActions" [labelBy]="'Chapter' + formatChapterNumber(chapter)"></app-card-actionables>&nbsp;
+ </span>Chapter {{formatChapterNumber(chapter)}}
<span class="badge badge-primary badge-pill">
<span *ngIf="chapter.pagesRead > 0 && chapter.pagesRead < chapter.pages">{{chapter.pagesRead}} / {{chapter.pages}}</span>
<span *ngIf="chapter.pagesRead === 0">UNREAD</span>
diff --git a/UI/Web/src/app/cards/_modals/edit-collection-tags/edit-collection-tags.component.html b/UI/Web/src/app/cards/_modals/edit-collection-tags/edit-collection-tags.component.html
index 168c9cf5d..2f7caacaf 100644
--- a/UI/Web/src/app/cards/_modals/edit-collection-tags/edit-collection-tags.component.html
+++ b/UI/Web/src/app/cards/_modals/edit-collection-tags/edit-collection-tags.component.html
@@ -11,7 +11,7 @@
Promotion means that the tag can be seen server-wide, not just for admin users. All series that have this tag will still have user-access restrictions placed on them.
</p>
- <ul ngbNav #nav="ngbNav" [(activeId)]="active" class="nav-tabs">
+ <ul ngbNav #nav="ngbNav" [(activeId)]="active" class="nav-tabs nav-pills">
<li [ngbNavItem]="tabs[0]">
<a ngbNavLink>{{tabs[0]}}</a>
<ng-template ngbNavContent>
diff --git a/UI/Web/src/app/cards/_modals/edit-series-modal/edit-series-modal.component.ts b/UI/Web/src/app/cards/_modals/edit-series-modal/edit-series-modal.component.ts
index 4f2103e67..1d1c2cbed 100644
--- a/UI/Web/src/app/cards/_modals/edit-series-modal/edit-series-modal.component.ts
+++ b/UI/Web/src/app/cards/_modals/edit-series-modal/edit-series-modal.component.ts
@@ -83,6 +83,7 @@ export class EditSeriesModalComponent implements OnInit, OnDestroy {
if (metadata) {
this.metadata = metadata;
this.settings.savedData = metadata.tags;
+ this.tags = metadata.tags;
}
});
@@ -147,6 +148,7 @@ export class EditSeriesModalComponent implements OnInit, OnDestroy {
this.seriesService.updateMetadata(this.metadata, this.tags)
];
+
if (selectedIndex > 0) {
apis.push(this.uploadService.updateSeriesCoverImage(model.id, this.selectedCover));
}
diff --git a/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.html b/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.html
index d005bab63..7f85064e3 100644
--- a/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.html
+++ b/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.html
@@ -3,8 +3,8 @@
<div class="col mr-auto">
<h2 style="display: inline-block">
<span *ngIf="actions.length > 0" class="">
- <app-card-actionables (actionHandler)="performAction($event)" [actions]="actions" [labelBy]="header"></app-card-actionables>
- </span>&nbsp;{{header}}&nbsp;
+ <app-card-actionables (actionHandler)="performAction($event)" [actions]="actions" [labelBy]="header"></app-card-actionables>&nbsp;
+ </span>{{header}}&nbsp;
<!-- NOTE: On mobile the pill can eat up a lot of space, we can hide it and move to the filter section if user is interested -->
<span class="badge badge-primary badge-pill" attr.aria-label="{{pagination.totalItems}} total items" *ngIf="pagination != undefined">{{pagination.totalItems}}</span>
</h2>
diff --git a/UI/Web/src/app/cards/card-item/card-item.component.ts b/UI/Web/src/app/cards/card-item/card-item.component.ts
index 826c068d8..80e6d2306 100644
--- a/UI/Web/src/app/cards/card-item/card-item.component.ts
+++ b/UI/Web/src/app/cards/card-item/card-item.component.ts
@@ -146,6 +146,7 @@ export class CardItemComponent implements OnInit, OnDestroy {
isPromoted() {
const tag = this.entity as CollectionTag;
+ // TODO: Validate if this works with reading lists
return tag.hasOwnProperty('promoted') && tag.promoted;
}
}
diff --git a/UI/Web/src/app/cards/series-card/series-card.component.ts b/UI/Web/src/app/cards/series-card/series-card.component.ts
index 42c1ccfde..cec632825 100644
--- a/UI/Web/src/app/cards/series-card/series-card.component.ts
+++ b/UI/Web/src/app/cards/series-card/series-card.component.ts
@@ -78,6 +78,9 @@ export class SeriesCardComponent implements OnInit, OnChanges {
case(Action.Bookmarks):
this.actionService.openBookmarkModal(series, (series) => {/* No Operation */ });
break;
+ case(Action.AddToReadingList):
+ this.actionService.addSeriesToReadingList(series, (series) => {/* No Operation */ });
+ break;
default:
break;
}
diff --git a/UI/Web/src/app/collections/all-collections/all-collections.component.html b/UI/Web/src/app/collections/all-collections/all-collections.component.html
index 38b7195f3..8cde25096 100644
--- a/UI/Web/src/app/collections/all-collections/all-collections.component.html
+++ b/UI/Web/src/app/collections/all-collections/all-collections.component.html
@@ -1,23 +1,8 @@
-<ng-container *ngIf="collectionTagId === 0; else collectionTagDetail;">
- <app-card-detail-layout header="Collections"
+<app-card-detail-layout header="Collections"
[isLoading]="isLoading"
[items]="collections"
- (pageChange)="onPageChange($event)"
>
<ng-template #cardItem let-item let-position="idx">
<app-card-item [title]="item.title" [entity]="item" [actions]="collectionTagActions" [imageUrl]="item.coverImage" (clicked)="loadCollection(item)"></app-card-item>
</ng-template>
- </app-card-detail-layout>
-</ng-container>
-<ng-template #collectionTagDetail>
- <app-card-detail-layout header="{{collectionTagName}} Collection"
- [isLoading]="isLoading"
- [items]="series"
- [pagination]="seriesPagination"
- (pageChange)="onPageChange($event)"
- >
- <ng-template #cardItem let-item let-position="idx">
- <app-series-card [data]="item" [libraryId]="item.libraryId" (reload)="loadPage()"></app-series-card>
- </ng-template>
- </app-card-detail-layout>
-</ng-template>
\ No newline at end of file
+</app-card-detail-layout>
\ No newline at end of file
diff --git a/UI/Web/src/app/collections/all-collections/all-collections.component.ts b/UI/Web/src/app/collections/all-collections/all-collections.component.ts
index d696b04bc..223894632 100644
--- a/UI/Web/src/app/collections/all-collections/all-collections.component.ts
+++ b/UI/Web/src/app/collections/all-collections/all-collections.component.ts
@@ -1,21 +1,14 @@
import { Component, OnInit } from '@angular/core';
import { Title } from '@angular/platform-browser';
-import { ActivatedRoute, Router } from '@angular/router';
+import { Router } from '@angular/router';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
-import { ToastrService } from 'ngx-toastr';
import { EditCollectionTagsComponent } from 'src/app/cards/_modals/edit-collection-tags/edit-collection-tags.component';
import { CollectionTag } from 'src/app/_models/collection-tag';
-import { Pagination } from 'src/app/_models/pagination';
-import { Series } from 'src/app/_models/series';
import { ActionItem, ActionFactoryService, Action } from 'src/app/_services/action-factory.service';
import { CollectionTagService } from 'src/app/_services/collection-tag.service';
import { ImageService } from 'src/app/_services/image.service';
-import { SeriesService } from 'src/app/_services/series.service';
-/**
- * This component is used as a standard layout for any card detail. ie) series, in-progress, collections, etc.
- */
@Component({
selector: 'app-all-collections',
templateUrl: './all-collections.component.html',
@@ -25,32 +18,13 @@ export class AllCollectionsComponent implements OnInit {
isLoading: boolean = true;
collections: CollectionTag[] = [];
- collectionTagId: number = 0; // 0 is not a valid id, if 0, we will load all tags
- collectionTagName: string = '';
- series: Array<Series> = [];
- seriesPagination!: Pagination;
collectionTagActions: ActionItem<CollectionTag>[] = [];
- constructor(private collectionService: CollectionTagService, private router: Router, private route: ActivatedRoute,
- private seriesService: SeriesService, private toastr: ToastrService, private actionFactoryService: ActionFactoryService,
- private modalService: NgbModal, private titleService: Title, private imageService: ImageService) {
+ constructor(private collectionService: CollectionTagService, private router: Router,
+ private actionFactoryService: ActionFactoryService, private modalService: NgbModal,
+ private titleService: Title, private imageService: ImageService) {
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
-
- const routeId = this.route.snapshot.paramMap.get('id');
- if (routeId != null) {
- this.collectionTagId = parseInt(routeId, 10);
- this.collectionService.allTags().subscribe(tags => {
- this.collections = tags;
- const matchingTags = this.collections.filter(t => t.id === this.collectionTagId);
- if (matchingTags.length === 0) {
- this.toastr.error('You don\'t have access to any libraries this tag belongs to or this tag is invalid');
- this.router.navigate(['collections']);
- return;
- }
- this.collectionTagName = tags.filter(item => item.id === this.collectionTagId)[0].title;
- this.titleService.setTitle('Kavita - ' + this.collectionTagName + ' Collection');
- });
- }
+ this.titleService.setTitle('Kavita - Collections');
}
ngOnInit() {
@@ -60,38 +34,15 @@ export class AllCollectionsComponent implements OnInit {
loadCollection(item: CollectionTag) {
- this.collectionTagId = item.id;
- this.collectionTagName = item.title;
- this.router.navigate(['collections', this.collectionTagId]);
+ this.router.navigate(['collections', item.id]);
this.loadPage();
}
- onPageChange(pagination: Pagination) {
- this.router.navigate(['collections', this.collectionTagId], {replaceUrl: true, queryParamsHandling: 'merge', queryParams: {page: this.seriesPagination.currentPage} });
- }
-
loadPage() {
- const page = this.route.snapshot.queryParamMap.get('page');
- if (page != null) {
- if (this.seriesPagination === undefined || this.seriesPagination === null) {
- this.seriesPagination = {currentPage: 0, itemsPerPage: 30, totalItems: 0, totalPages: 1};
- }
- this.seriesPagination.currentPage = parseInt(page, 10);
- }
- // Reload page after a series is updated or first load
- if (this.collectionTagId === 0) {
- this.collectionService.allTags().subscribe(tags => {
- this.collections = tags;
- this.isLoading = false;
- });
- } else {
- this.seriesService.getSeriesForTag(this.collectionTagId, this.seriesPagination?.currentPage, this.seriesPagination?.itemsPerPage).subscribe(tags => {
- this.series = tags.result;
- this.seriesPagination = tags.pagination;
- this.isLoading = false;
- window.scrollTo(0, 0);
- });
- }
+ this.collectionService.allTags().subscribe(tags => {
+ this.collections = tags;
+ this.isLoading = false;
+ });
}
handleCollectionActionCallback(action: Action, collectionTag: CollectionTag) {
diff --git a/UI/Web/src/app/collections/collections.module.ts b/UI/Web/src/app/collections/collections.module.ts
index eb0f8690e..0863647c8 100644
--- a/UI/Web/src/app/collections/collections.module.ts
+++ b/UI/Web/src/app/collections/collections.module.ts
@@ -18,6 +18,9 @@ import { AllCollectionsComponent } from './all-collections/all-collections.compo
SharedModule,
CardsModule,
CollectionsRoutingModule,
+ ],
+ exports: [
+ AllCollectionsComponent
]
})
export class CollectionsModule { }
diff --git a/UI/Web/src/app/dashboard/dashboard.component.html b/UI/Web/src/app/dashboard/dashboard.component.html
new file mode 100644
index 000000000..73bda1d74
--- /dev/null
+++ b/UI/Web/src/app/dashboard/dashboard.component.html
@@ -0,0 +1,21 @@
+<div class="container-fluid">
+ <nav role="navigation">
+ <ul ngbNav #nav="ngbNav" [(activeId)]="active" class="nav nav-pills justify-content-center mt-3" role="tab">
+ <li *ngFor="let tab of tabs" [ngbNavItem]="tab" class="nav-item">
+ <a ngbNavLink routerLink="." [fragment]="tab.fragment">{{ tab.title | titlecase }}</a>
+ <ng-template ngbNavContent>
+ <ng-container *ngIf="tab.fragment === ''">
+ <app-library></app-library>
+ </ng-container>
+ <ng-container *ngIf="tab.fragment === 'lists'">
+ <app-reading-lists></app-reading-lists>
+ </ng-container>
+ <ng-container *ngIf="tab.fragment === 'collections'">
+ <app-all-collections></app-all-collections>
+ </ng-container>
+ </ng-template>
+ </li>
+ </ul>
+ </nav>
+ <div [ngbNavOutlet]="nav" class="mt-3"></div>
+</div>
\ No newline at end of file
diff --git a/UI/Web/src/app/dashboard/dashboard.component.scss b/UI/Web/src/app/dashboard/dashboard.component.scss
new file mode 100644
index 000000000..e69de29bb
diff --git a/UI/Web/src/app/dashboard/dashboard.component.ts b/UI/Web/src/app/dashboard/dashboard.component.ts
new file mode 100644
index 000000000..518ee208e
--- /dev/null
+++ b/UI/Web/src/app/dashboard/dashboard.component.ts
@@ -0,0 +1,37 @@
+import { Component, OnInit } from '@angular/core';
+import { Title } from '@angular/platform-browser';
+import { ActivatedRoute } from '@angular/router';
+import { ToastrService } from 'ngx-toastr';
+import { ServerService } from '../_services/server.service';
+
+@Component({
+ selector: 'app-dashboard',
+ templateUrl: './dashboard.component.html',
+ styleUrls: ['./dashboard.component.scss']
+})
+export class DashboardComponent implements OnInit {
+
+ tabs: Array<{title: string, fragment: string}> = [
+ {title: 'Libraries', fragment: ''},
+ {title: 'Lists', fragment: 'lists'},
+ {title: 'Collections', fragment: 'collections'},
+ ];
+ active = this.tabs[0];
+
+ constructor(public route: ActivatedRoute, private serverService: ServerService,
+ private toastr: ToastrService, private titleService: Title) {
+ this.route.fragment.subscribe(frag => {
+ const tab = this.tabs.filter(item => item.fragment === frag);
+ if (tab.length > 0) {
+ this.active = tab[0];
+ } else {
+ this.active = this.tabs[0]; // Default to first tab
+ }
+ });
+ this.titleService.setTitle('Kavita - Dashboard');
+ }
+
+ ngOnInit(): void {
+ }
+
+}
diff --git a/UI/Web/src/app/library/library.component.html b/UI/Web/src/app/library/library.component.html
index c80c3223f..d1522bb8a 100644
--- a/UI/Web/src/app/library/library.component.html
+++ b/UI/Web/src/app/library/library.component.html
@@ -1,33 +1,24 @@
+<div *ngIf="libraries.length === 0 && !isLoading && isAdmin" class="d-flex justify-content-center">
+ <p>There are no libraries setup yet. Configure some in <a href="/admin/dashboard#libraries">Server settings</a>.</p>
+</div>
+<div *ngIf="libraries.length === 0 && !isLoading && !isAdmin" class="d-flex justify-content-center">
+ <p>You haven't been granted access to any libraries.</p>
+</div>
-<div class="container-fluid">
- <div *ngIf="libraries.length === 0 && !isLoading && isAdmin" class="d-flex justify-content-center">
- <p>There are no libraries setup yet. Configure some in <a href="/admin/dashboard#libraries">Server settings</a>.</p>
- </div>
- <div *ngIf="libraries.length === 0 && !isLoading && !isAdmin" class="d-flex justify-content-center">
- <p>You haven't been granted access to any libraries.</p>
- </div>
- <app-carousel-reel [items]="libraries" title="Libraries">
- <ng-template #carouselItem let-item let-position="idx">
- <app-library-card [data]="item"></app-library-card>
- </ng-template>
- </app-carousel-reel>
+<app-carousel-reel [items]="inProgress" title="In Progress" (sectionClick)="handleSectionClick($event)">
+ <ng-template #carouselItem let-item let-position="idx">
+ <app-series-card [data]="item" [libraryId]="item.libraryId" (reload)="reloadInProgress($event)" (dataChanged)="reloadInProgress($event)"></app-series-card>
+ </ng-template>
+</app-carousel-reel>
- <app-carousel-reel [items]="inProgress" title="In Progress" (sectionClick)="handleSectionClick($event)">
- <ng-template #carouselItem let-item let-position="idx">
- <app-series-card [data]="item" [libraryId]="item.libraryId" (reload)="reloadInProgress($event)" (dataChanged)="reloadInProgress($event)"></app-series-card>
- </ng-template>
- </app-carousel-reel>
+<app-carousel-reel [items]="recentlyAdded" title="Recently Added" (sectionClick)="handleSectionClick($event)">
+ <ng-template #carouselItem let-item let-position="idx">
+ <app-series-card [data]="item" [libraryId]="item.libraryId" (reload)="reloadTags()" (dataChanged)="loadRecentlyAdded()"></app-series-card>
+ </ng-template>
+</app-carousel-reel>
- <app-carousel-reel [items]="recentlyAdded" title="Recently Added" (sectionClick)="handleSectionClick($event)">
- <ng-template #carouselItem let-item let-position="idx">
- <app-series-card [data]="item" [libraryId]="item.libraryId" (reload)="reloadTags()" (dataChanged)="loadRecentlyAdded()"></app-series-card>
- </ng-template>
- </app-carousel-reel>
-
- <app-carousel-reel [items]="collectionTags" title="Collections" (sectionClick)="handleSectionClick($event)">
- <ng-template #carouselItem let-item let-position="idx">
- <app-card-item [title]="item.title" [entity]="item" [actions]="collectionTagActions" [imageUrl]="item.coverImage" (clicked)="loadCollection(item)"></app-card-item>
- </ng-template>
- </app-carousel-reel>
-
-</div>
\ No newline at end of file
+<app-carousel-reel [items]="libraries" title="Libraries">
+ <ng-template #carouselItem let-item let-position="idx">
+ <app-library-card [data]="item"></app-library-card>
+ </ng-template>
+</app-carousel-reel>
diff --git a/UI/Web/src/app/library/library.component.ts b/UI/Web/src/app/library/library.component.ts
index f31e98445..bf862f730 100644
--- a/UI/Web/src/app/library/library.component.ts
+++ b/UI/Web/src/app/library/library.component.ts
@@ -5,7 +5,6 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { Subject } from 'rxjs';
import { take, takeUntil } from 'rxjs/operators';
import { EditCollectionTagsComponent } from '../cards/_modals/edit-collection-tags/edit-collection-tags.component';
-import { ScrollService } from '../scroll.service';
import { CollectionTag } from '../_models/collection-tag';
import { InProgressChapter } from '../_models/in-progress-chapter';
import { Library } from '../_models/library';
@@ -33,8 +32,8 @@ export class LibraryComponent implements OnInit, OnDestroy {
recentlyAdded: Series[] = [];
inProgress: Series[] = [];
continueReading: InProgressChapter[] = [];
- collectionTags: CollectionTag[] = [];
- collectionTagActions: ActionItem<CollectionTag>[] = [];
+ // collectionTags: CollectionTag[] = [];
+ // collectionTagActions: ActionItem<CollectionTag>[] = [];
private readonly onDestroy = new Subject<void>();
@@ -43,8 +42,7 @@ export class LibraryComponent implements OnInit, OnDestroy {
constructor(public accountService: AccountService, private libraryService: LibraryService,
private seriesService: SeriesService, private actionFactoryService: ActionFactoryService,
private collectionService: CollectionTagService, private router: Router,
- private modalService: NgbModal, private titleService: Title, public imageService: ImageService,
- private scrollService: ScrollService) { }
+ private modalService: NgbModal, private titleService: Title, public imageService: ImageService) { }
ngOnInit(): void {
this.titleService.setTitle('Kavita - Dashboard');
@@ -58,7 +56,7 @@ export class LibraryComponent implements OnInit, OnDestroy {
});
});
- this.collectionTagActions = this.actionFactoryService.getCollectionTagActions(this.handleCollectionActionCallback.bind(this));
+ //this.collectionTagActions = this.actionFactoryService.getCollectionTagActions(this.handleCollectionActionCallback.bind(this));
this.reloadSeries();
}
@@ -103,9 +101,9 @@ export class LibraryComponent implements OnInit, OnDestroy {
}
reloadTags() {
- this.collectionService.allTags().pipe(takeUntil(this.onDestroy)).subscribe(tags => {
- this.collectionTags = tags;
- });
+ // this.collectionService.allTags().pipe(takeUntil(this.onDestroy)).subscribe(tags => {
+ // this.collectionTags = tags;
+ // });
}
handleSectionClick(sectionTitle: string) {
@@ -119,24 +117,24 @@ export class LibraryComponent implements OnInit, OnDestroy {
}
loadCollection(item: CollectionTag) {
- this.router.navigate(['collections', item.id]);
+ //this.router.navigate(['collections', item.id]);
}
- handleCollectionActionCallback(action: Action, collectionTag: CollectionTag) {
- switch (action) {
- case(Action.Edit):
- const modalRef = this.modalService.open(EditCollectionTagsComponent, { size: 'lg', scrollable: true });
- modalRef.componentInstance.tag = collectionTag;
- modalRef.closed.subscribe((results: {success: boolean, coverImageUpdated: boolean}) => {
- this.reloadTags();
- if (results.coverImageUpdated) {
- collectionTag.coverImage = this.imageService.randomize(collectionTag.coverImage);
- }
- });
- break;
- default:
- break;
- }
- }
+ // handleCollectionActionCallback(action: Action, collectionTag: CollectionTag) {
+ // switch (action) {
+ // case(Action.Edit):
+ // const modalRef = this.modalService.open(EditCollectionTagsComponent, { size: 'lg', scrollable: true });
+ // modalRef.componentInstance.tag = collectionTag;
+ // modalRef.closed.subscribe((results: {success: boolean, coverImageUpdated: boolean}) => {
+ // this.reloadTags();
+ // if (results.coverImageUpdated) {
+ // collectionTag.coverImage = this.imageService.randomize(collectionTag.coverImage);
+ // }
+ // });
+ // break;
+ // default:
+ // break;
+ // }
+ // }
}
diff --git a/UI/Web/src/app/manga-reader/_models/chapter-info.ts b/UI/Web/src/app/manga-reader/_models/chapter-info.ts
index fff07b12b..f83c86902 100644
--- a/UI/Web/src/app/manga-reader/_models/chapter-info.ts
+++ b/UI/Web/src/app/manga-reader/_models/chapter-info.ts
@@ -1,8 +1,13 @@
+import { MangaFormat } from "src/app/_models/manga-format";
+
export interface ChapterInfo {
chapterNumber: string;
volumeNumber: string;
chapterTitle: string;
seriesName: string;
+ seriesFormat: MangaFormat;
+ seriesId: number;
+ libraryId: number;
fileName: string;
isSpecial: boolean;
volumeId: number;
diff --git a/UI/Web/src/app/manga-reader/manga-reader.component.ts b/UI/Web/src/app/manga-reader/manga-reader.component.ts
index 42fc7777c..df6239772 100644
--- a/UI/Web/src/app/manga-reader/manga-reader.component.ts
+++ b/UI/Web/src/app/manga-reader/manga-reader.component.ts
@@ -22,6 +22,7 @@ import { ChapterInfo } from './_models/chapter-info';
import { COLOR_FILTER, FITTING_OPTION, PAGING_DIRECTION, SPLIT_PAGE_PART } from './_models/reader-enums';
import { Preferences, scalingOptions } from '../_models/preferences/preferences';
import { READER_MODE } from '../_models/preferences/reader-mode';
+import { MangaFormat } from '../_models/manga-format';
const PREFETCH_PAGES = 5;
@@ -65,12 +66,20 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
seriesId!: number;
volumeId!: number;
chapterId!: number;
+ /**
+ * Reading List id. Defaults to -1.
+ */
+ readingListId: number = CHAPTER_ID_DOESNT_EXIST;
/**
* If this is true, no progress will be saved.
*/
incognitoMode: boolean = false;
+ /**
+ * If this is true, chapters will be fetched in the order of a reading list, rather than natural series order.
+ */
+ readingListMode: boolean = false;
/**
* The current page. UI will show this number + 1.
*/
@@ -265,6 +274,13 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.seriesId = parseInt(seriesId, 10);
this.chapterId = parseInt(chapterId, 10);
this.incognitoMode = this.route.snapshot.queryParamMap.get('incognitoMode') === 'true';
+
+ const readingListId = this.route.snapshot.queryParamMap.get('readingListId');
+ if (readingListId != null) {
+ this.readingListMode = true;
+ this.readingListId = parseInt(readingListId, 10);
+ }
+
this.continuousChaptersStack.push(this.chapterId);
@@ -365,6 +381,14 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
chapterInfo: this.readerService.getChapterInfo(this.seriesId, this.chapterId),
bookmarks: this.readerService.getBookmarks(this.chapterId)
}).pipe(take(1)).subscribe(results => {
+
+ if (this.readingListMode && results.chapterInfo.seriesFormat === MangaFormat.EPUB) {
+ // Redirect to the book reader.
+ const params = this.readerService.getQueryParamsObject(this.incognitoMode, this.readingListMode, this.readingListId);
+ this.router.navigate(['library', results.chapterInfo.libraryId, 'series', results.chapterInfo.seriesId, 'book', this.chapterId], {queryParams: params});
+ return;
+ }
+
this.volumeId = results.chapterInfo.volumeId;
this.maxPages = results.chapterInfo.pages;
@@ -387,13 +411,13 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.bookmarks[bookmark.page] = 1;
});
- this.readerService.getNextChapter(this.seriesId, this.volumeId, this.chapterId).pipe(take(1)).subscribe(chapterId => {
+ this.readerService.getNextChapter(this.seriesId, this.volumeId, this.chapterId, this.readingListId).pipe(take(1)).subscribe(chapterId => {
this.nextChapterId = chapterId;
if (chapterId === CHAPTER_ID_DOESNT_EXIST || chapterId === this.chapterId) {
this.nextChapterDisabled = true;
}
});
- this.readerService.getPrevChapter(this.seriesId, this.volumeId, this.chapterId).pipe(take(1)).subscribe(chapterId => {
+ this.readerService.getPrevChapter(this.seriesId, this.volumeId, this.chapterId, this.readingListId).pipe(take(1)).subscribe(chapterId => {
this.prevChapterId = chapterId;
if (chapterId === CHAPTER_ID_DOESNT_EXIST || chapterId === this.chapterId) {
this.prevChapterDisabled = true;
@@ -674,7 +698,7 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
if (this.nextPageDisabled) { return; }
this.isLoading = true;
if (this.nextChapterId === CHAPTER_ID_NOT_FETCHED || this.nextChapterId === this.chapterId) {
- this.readerService.getNextChapter(this.seriesId, this.volumeId, this.chapterId).pipe(take(1)).subscribe(chapterId => {
+ this.readerService.getNextChapter(this.seriesId, this.volumeId, this.chapterId, this.readingListId).pipe(take(1)).subscribe(chapterId => {
this.nextChapterId = chapterId;
this.loadChapter(chapterId, 'next');
});
@@ -697,7 +721,7 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
}
if (this.prevChapterId === CHAPTER_ID_NOT_FETCHED || this.prevChapterId === this.chapterId) {
- this.readerService.getPrevChapter(this.seriesId, this.volumeId, this.chapterId).pipe(take(1)).subscribe(chapterId => {
+ this.readerService.getPrevChapter(this.seriesId, this.volumeId, this.chapterId, this.readingListId).pipe(take(1)).subscribe(chapterId => {
this.prevChapterId = chapterId;
this.loadChapter(chapterId, 'prev');
});
@@ -711,11 +735,7 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.chapterId = chapterId;
this.continuousChaptersStack.push(chapterId);
// Load chapter Id onto route but don't reload
- const lastSlashIndex = this.router.url.lastIndexOf('/');
- let newRoute = this.router.url.substring(0, lastSlashIndex + 1) + this.chapterId + '';
- if (this.incognitoMode) {
- newRoute += '?incognitoMode=true';
- }
+ const newRoute = this.readerService.getNextChapterUrl(this.router.url, this.chapterId, this.incognitoMode, this.readingListMode, this.readingListId);
window.history.replaceState({}, '', newRoute);
this.init();
} else {
@@ -734,7 +754,6 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
renderPage() {
if (this.ctx && this.canvas) {
this.canvasImage.onload = null;
- //this.ctx.imageSmoothingEnabled = true;
this.canvas.nativeElement.width = this.canvasImage.width;
this.canvas.nativeElement.height = this.canvasImage.height;
const needsSplitting = this.canvasImage.width > this.canvasImage.height;
diff --git a/UI/Web/src/app/manga-reader/manga-reader.router.module.ts b/UI/Web/src/app/manga-reader/manga-reader.router.module.ts
index 388f727b2..680c7cde7 100644
--- a/UI/Web/src/app/manga-reader/manga-reader.router.module.ts
+++ b/UI/Web/src/app/manga-reader/manga-reader.router.module.ts
@@ -6,7 +6,12 @@ const routes: Routes = [
{
path: ':chapterId',
component: MangaReaderComponent
- }
+ },
+ {
+ // This will allow the MangaReader to have a list to use for next/prev chapters rather than natural sort order
+ path: ':chapterId/list/:listId',
+ component: MangaReaderComponent
+}
];
diff --git a/UI/Web/src/app/nav-header/nav-header.component.ts b/UI/Web/src/app/nav-header/nav-header.component.ts
index 1216af274..d9005bc10 100644
--- a/UI/Web/src/app/nav-header/nav-header.component.ts
+++ b/UI/Web/src/app/nav-header/nav-header.component.ts
@@ -72,7 +72,7 @@ export class NavHeaderComponent implements OnInit, OnDestroy {
onChangeSearch(val: string) {
this.isLoading = true;
- this.searchTerm = val;
+ this.searchTerm = val.trim();
this.libraryService.search(val).pipe(takeUntil(this.onDestroy)).subscribe(results => {
this.searchResults = results;
this.isLoading = false;
diff --git a/UI/Web/src/app/reading-list/_modals/add-to-list-modal/add-to-list-modal.component.html b/UI/Web/src/app/reading-list/_modals/add-to-list-modal/add-to-list-modal.component.html
new file mode 100644
index 000000000..8ef6a61a4
--- /dev/null
+++ b/UI/Web/src/app/reading-list/_modals/add-to-list-modal/add-to-list-modal.component.html
@@ -0,0 +1,37 @@
+
+<div class="modal-header">
+ <h4 class="modal-title" id="modal-basic-title">Add to Reading List</h4>
+ <button type="button" class="close" aria-label="Close" (click)="close()">
+ <span aria-hidden="true">&times;</span>
+ </button>
+</div>
+<div class="modal-body">
+ <!-- TODO: Put filter here -->
+ <ul class="list-group">
+ <li class="list-group-item clickable" tabindex="0" role="button" *ngFor="let readingList of lists; let i = index" (click)="addToList(readingList)">
+ <!-- Think about using radio buttons maybe for screen reader-->
+ {{readingList.title}} <i class="fa fa-angle-double-up" *ngIf="readingList.promoted" title="Promoted"></i>
+ </li>
+ <li class="list-group-item" *ngIf="lists.length === 0 && !loading">No lists created yet</li>
+ <li class="list-group-item" *ngIf="loading">
+ <div class="spinner-border text-secondary" role="status">
+ <span class="sr-only">Loading...</span>
+ </div>
+ </li>
+ </ul>
+</div>
+<div class="modal-footer" style="justify-content: normal">
+ <form style="width: 100%" [formGroup]="listForm">
+ <div class="form-row">
+ <div class="col-md-10">
+ <label class="sr-only" for="add-rlist">Reading List</label>
+ <input width="100%" #title ngbAutofocus type="text" class="form-control mb-2" id="add-rlist" formControlName="title">
+ </div>
+ <div class="col-md-2">
+ <button type="submit" class="btn btn-primary" (click)="create()">Create</button>
+ </div>
+ </div>
+ </form>
+</div>
+
+
diff --git a/UI/Web/src/app/reading-list/_modals/add-to-list-modal/add-to-list-modal.component.scss b/UI/Web/src/app/reading-list/_modals/add-to-list-modal/add-to-list-modal.component.scss
new file mode 100644
index 000000000..91847160a
--- /dev/null
+++ b/UI/Web/src/app/reading-list/_modals/add-to-list-modal/add-to-list-modal.component.scss
@@ -0,0 +1,7 @@
+.clickable {
+ cursor: pointer;
+}
+
+.clickable:hover, .clickable:focus {
+ background-color: lightgreen;
+}
\ No newline at end of file
diff --git a/UI/Web/src/app/reading-list/_modals/add-to-list-modal/add-to-list-modal.component.ts b/UI/Web/src/app/reading-list/_modals/add-to-list-modal/add-to-list-modal.component.ts
new file mode 100644
index 000000000..846c054c1
--- /dev/null
+++ b/UI/Web/src/app/reading-list/_modals/add-to-list-modal/add-to-list-modal.component.ts
@@ -0,0 +1,90 @@
+import { AfterViewInit, Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
+import { FormControl, FormGroup, Validators } from '@angular/forms';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { ReadingList } from 'src/app/_models/reading-list';
+import { ReadingListService } from 'src/app/_services/reading-list.service';
+
+export enum ADD_FLOW {
+ Series = 0,
+ Volume = 1,
+ Chapter = 2
+}
+
+@Component({
+ selector: 'app-add-to-list-modal',
+ templateUrl: './add-to-list-modal.component.html',
+ styleUrls: ['./add-to-list-modal.component.scss']
+})
+export class AddToListModalComponent implements OnInit, AfterViewInit {
+
+ @Input() title!: string;
+ @Input() seriesId?: number;
+ @Input() volumeId?: number;
+ @Input() chapterId?: number;
+ /**
+ * Determines which Input is required and which API is used to associate to the Reading List
+ */
+ @Input() type!: ADD_FLOW;
+
+ /**
+ * All existing reading lists sorted by recent use date
+ */
+ lists: Array<any> = [];
+ loading: boolean = false;
+ listForm: FormGroup = new FormGroup({});
+
+ @ViewChild('title') inputElem!: ElementRef<HTMLInputElement>;
+
+
+ constructor(private modal: NgbActiveModal, private readingListService: ReadingListService) { }
+
+ ngOnInit(): void {
+
+ this.listForm.addControl('title', new FormControl(this.title, []));
+
+ this.loading = true;
+ this.readingListService.getReadingLists(false).subscribe(lists => {
+ this.lists = lists.result;
+ this.loading = false;
+ });
+
+
+ }
+
+ ngAfterViewInit() {
+ // Shift focus to input
+ if (this.inputElem) {
+ this.inputElem.nativeElement.select();
+ }
+ }
+
+ close() {
+ this.modal.close();
+ }
+
+ create() {
+ this.readingListService.createList(this.listForm.value.title).subscribe(list => {
+ this.addToList(list);
+ });
+ }
+
+ addToList(readingList: ReadingList) {
+ if (this.seriesId === undefined) return;
+
+ if (this.type === ADD_FLOW.Series) {
+ this.readingListService.updateBySeries(readingList.id, this.seriesId).subscribe(() => {
+ this.modal.close();
+ });
+ } else if (this.type === ADD_FLOW.Volume && this.volumeId !== undefined) {
+ this.readingListService.updateByVolume(readingList.id, this.seriesId, this.volumeId).subscribe(() => {
+ this.modal.close();
+ });
+ } else if (this.type === ADD_FLOW.Chapter && this.chapterId !== undefined) {
+ this.readingListService.updateByChapter(readingList.id, this.seriesId, this.chapterId).subscribe(() => {
+ this.modal.close();
+ });
+ }
+
+ }
+
+}
diff --git a/UI/Web/src/app/reading-list/_modals/edit-reading-list-modal/edit-reading-list-modal.component.html b/UI/Web/src/app/reading-list/_modals/edit-reading-list-modal/edit-reading-list-modal.component.html
new file mode 100644
index 000000000..c07d65d6a
--- /dev/null
+++ b/UI/Web/src/app/reading-list/_modals/edit-reading-list-modal/edit-reading-list-modal.component.html
@@ -0,0 +1,31 @@
+
+<div class="modal-header">
+ <h4 class="modal-title" id="modal-basic-title">Edit {{readingList.title}} Reading List</h4>
+ <button type="button" class="close" aria-label="Close" (click)="close()">
+ <span aria-hidden="true">&times;</span>
+ </button>
+</div>
+<div class="modal-body">
+ <p>
+ This list is currently {{readingList?.promoted ? 'promoted' : 'not promoted'}} (<i class="fa fa-angle-double-up" aria-hidden="true"></i>).
+ Promotion means that the list can be seen server-wide, not just for admin users. All series that are within this list will still have user-access restrictions placed on them.
+ </p>
+ <form [formGroup]="reviewGroup">
+ <div class="form-group">
+ <label for="title">Name</label>
+ <input id="title" class="form-control" formControlName="title" type="text">
+ </div>
+
+ <div class="form-group">
+ <label for="summary">Summary</label>
+ <textarea id="summary" class="form-control" formControlName="summary" rows="3"></textarea>
+ </div>
+ </form>
+</div>
+<div class="modal-footer">
+ <button type="button" class="btn btn-secondary" (click)="close()">Close</button>
+ <button type="button" class="btn btn-info" (click)="togglePromotion()">{{readingList.promoted ? 'Demote' : 'Promote'}}</button>
+ <button type="submit" class="btn btn-primary" [disabled]="reviewGroup.get('title')?.value.trim().length === 0" (click)="save()">Save</button>
+</div>
+
+
diff --git a/UI/Web/src/app/reading-list/_modals/edit-reading-list-modal/edit-reading-list-modal.component.scss b/UI/Web/src/app/reading-list/_modals/edit-reading-list-modal/edit-reading-list-modal.component.scss
new file mode 100644
index 000000000..e69de29bb
diff --git a/UI/Web/src/app/reading-list/_modals/edit-reading-list-modal/edit-reading-list-modal.component.ts b/UI/Web/src/app/reading-list/_modals/edit-reading-list-modal/edit-reading-list-modal.component.ts
new file mode 100644
index 000000000..58bd80b9b
--- /dev/null
+++ b/UI/Web/src/app/reading-list/_modals/edit-reading-list-modal/edit-reading-list-modal.component.ts
@@ -0,0 +1,52 @@
+import { Component, Input, OnInit } from '@angular/core';
+import { FormGroup, FormControl, Validators } from '@angular/forms';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { ReadingList } from 'src/app/_models/reading-list';
+import { ReadingListService } from 'src/app/_services/reading-list.service';
+
+@Component({
+ selector: 'app-edit-reading-list-modal',
+ templateUrl: './edit-reading-list-modal.component.html',
+ styleUrls: ['./edit-reading-list-modal.component.scss']
+})
+export class EditReadingListModalComponent implements OnInit {
+
+ @Input() readingList!: ReadingList;
+ reviewGroup!: FormGroup;
+
+ constructor(private ngModal: NgbActiveModal, private readingListService: ReadingListService) { }
+
+ ngOnInit(): void {
+ this.reviewGroup = new FormGroup({
+ title: new FormControl(this.readingList.title, [Validators.required]),
+ summary: new FormControl(this.readingList.summary, [])
+ });
+ }
+
+ close() {
+ this.ngModal.dismiss(undefined);
+ }
+
+ save() {
+ if (this.reviewGroup.value.title.trim() === '') return;
+ const model = {...this.reviewGroup.value, readingListId: this.readingList.id, promoted: this.readingList.promoted};
+
+ this.readingListService.update(model).subscribe(() => {
+ this.readingList.title = model.title;
+ this.readingList.summary = model.summary;
+ this.ngModal.close(this.readingList);
+ });
+ }
+
+ togglePromotion() {
+ const originalPromotion = this.readingList.promoted;
+ this.readingList.promoted = !this.readingList.promoted;
+ const model = {readingListId: this.readingList.id, promoted: this.readingList.promoted};
+ this.readingListService.update(model).subscribe(res => {
+ /* No Operation */
+ }, err => {
+ this.readingList.promoted = originalPromotion;
+ });
+ }
+
+}
diff --git a/UI/Web/src/app/reading-list/dragable-ordered-list/dragable-ordered-list.component.html b/UI/Web/src/app/reading-list/dragable-ordered-list/dragable-ordered-list.component.html
new file mode 100644
index 000000000..b2fadabd9
--- /dev/null
+++ b/UI/Web/src/app/reading-list/dragable-ordered-list/dragable-ordered-list.component.html
@@ -0,0 +1,20 @@
+<div cdkDropList class="{{items.length > 0 ? 'example-list list-group-flush' : ''}}" (cdkDropListDropped)="drop($event)">
+ <div class="example-box" *ngFor="let item of items; index as i" cdkDrag [cdkDragData]="item" cdkDragBoundary=".example-list">
+ <div class="mr-3 align-middle">
+ <i class="fa fa-grip-vertical drag-handle" aria-hidden="true" cdkDragHandle></i>
+ <label for="reorder-{{i}}" class="sr-only">Reorder</label>
+ <input *ngIf="accessibilityMode" id="reorder-{{i}}" type="number" min="0" [max]="items.length - 1" [value]="i" style="width: 40px" (keydown.enter)="updateIndex(i, item)" aria-describedby="instructions">
+ </div>
+
+ <ng-container style="display: inline-block" [ngTemplateOutlet]="itemTemplate" [ngTemplateOutletContext]="{ $implicit: item, idx: i }"></ng-container>
+
+ <button class="btn btn-icon pull-right" (click)="removeItem(item, i)">
+ <i class="fa fa-times" aria-hidden="true"></i>
+ <span class="sr-only" attr.aria-labelledby="item.id--{{i}}">Remove item</span>
+ </button>
+ </div>
+</div>
+
+<p class="sr-only" id="instructions">
+
+</p>
\ No newline at end of file
diff --git a/UI/Web/src/app/reading-list/dragable-ordered-list/dragable-ordered-list.component.scss b/UI/Web/src/app/reading-list/dragable-ordered-list/dragable-ordered-list.component.scss
new file mode 100644
index 000000000..dff8f4cfc
--- /dev/null
+++ b/UI/Web/src/app/reading-list/dragable-ordered-list/dragable-ordered-list.component.scss
@@ -0,0 +1,53 @@
+.example-list {
+ min-width: 500px;
+ max-width: 100%;
+ //border: solid 1px #ccc;
+ min-height: 60px;
+ display: block;
+ //background: white;
+ border-radius: 4px;
+ overflow: hidden;
+ }
+
+ .example-box {
+ padding: 20px 10px;
+ border-bottom: solid 1px #ccc;
+ //color: rgba(0, 0, 0, 0.87);
+ display: flex;
+ flex-direction: row;
+ //align-items: center;
+ //justify-content: space-between;
+ box-sizing: border-box;
+ //background: white;
+ font-size: 14px;
+
+ .drag-handle {
+ cursor: move;
+ font-size: 24px;
+ margin-top: 215%;
+ }
+ }
+
+ .cdk-drag-preview {
+ box-sizing: border-box;
+ border-radius: 4px;
+ box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2),
+ 0 8px 10px 1px rgba(0, 0, 0, 0.14),
+ 0 3px 14px 2px rgba(0, 0, 0, 0.12);
+ }
+
+ .cdk-drag-placeholder {
+ opacity: 0;
+ }
+
+ .cdk-drag-animating {
+ transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
+ }
+
+ .example-box:last-child {
+ border: none;
+ }
+
+ .example-list.cdk-drop-list-dragging .example-box:not(.cdk-drag-placeholder) {
+ transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
+ }
\ No newline at end of file
diff --git a/UI/Web/src/app/reading-list/dragable-ordered-list/dragable-ordered-list.component.ts b/UI/Web/src/app/reading-list/dragable-ordered-list/dragable-ordered-list.component.ts
new file mode 100644
index 000000000..fddf4ac43
--- /dev/null
+++ b/UI/Web/src/app/reading-list/dragable-ordered-list/dragable-ordered-list.component.ts
@@ -0,0 +1,63 @@
+import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
+import { Component, ContentChild, EventEmitter, Input, OnInit, Output, TemplateRef } from '@angular/core';
+
+export interface IndexUpdateEvent {
+ fromPosition: number;
+ toPosition: number;
+ item: any;
+}
+
+export interface ItemRemoveEvent {
+ position: number;
+ item: any;
+}
+
+@Component({
+ selector: 'app-dragable-ordered-list',
+ templateUrl: './dragable-ordered-list.component.html',
+ styleUrls: ['./dragable-ordered-list.component.scss']
+})
+export class DragableOrderedListComponent implements OnInit {
+
+ @Input() accessibilityMode: boolean = false;
+ @Input() items: Array<any> = [];
+ @Output() orderUpdated: EventEmitter<IndexUpdateEvent> = new EventEmitter<IndexUpdateEvent>();
+ @Output() itemRemove: EventEmitter<ItemRemoveEvent> = new EventEmitter<ItemRemoveEvent>();
+ @ContentChild('draggableItem') itemTemplate!: TemplateRef<any>;
+
+ constructor() { }
+
+ ngOnInit(): void {
+ }
+
+ drop(event: CdkDragDrop<string[]>) {
+ if (event.previousIndex === event.currentIndex) return;
+ moveItemInArray(this.items, event.previousIndex, event.currentIndex);
+ this.orderUpdated.emit({
+ fromPosition: event.previousIndex,
+ toPosition: event.currentIndex,
+ item: this.items[event.currentIndex]
+ });
+ }
+
+ updateIndex(previousIndex: number, item: any) {
+ // get the new value of the input
+ var inputElem = <HTMLInputElement>document.querySelector('#reorder-' + previousIndex);
+ const newIndex = parseInt(inputElem.value, 10);
+ if (previousIndex === newIndex) return;
+ moveItemInArray(this.items, previousIndex, newIndex);
+ this.orderUpdated.emit({
+ fromPosition: previousIndex,
+ toPosition: newIndex,
+ item: this.items[newIndex]
+ });
+ }
+
+ removeItem(item: any, position: number) {
+ this.itemRemove.emit({
+ position,
+ item
+ });
+ }
+
+}
diff --git a/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.html b/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.html
new file mode 100644
index 000000000..623d0cf9f
--- /dev/null
+++ b/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.html
@@ -0,0 +1,58 @@
+<div class="container mt-2" *ngIf="readingList">
+ <div class="row mb-3">
+ <div class="col-md-10 col-xs-8 col-sm-6">
+ <div class="row no-gutters">
+
+ <h2 style="display: inline-block">
+ <span *ngIf="actions.length > 0">
+ <app-card-actionables (actionHandler)="performAction($event)" [actions]="actions" [labelBy]="readingList.title"></app-card-actionables>&nbsp;
+ </span>
+ {{readingList.title}}&nbsp;<span *ngIf="readingList?.promoted">(<i class="fa fa-angle-double-up" aria-hidden="true"></i>)</span>&nbsp;
+ <span class="badge badge-primary badge-pill" attr.aria-label="{{items.length}} total items">{{items.length}}</span>
+ </h2>
+ </div>
+ <div class="row no-gutters">
+ <div class="mr-2">
+ <button class="btn btn-primary" title="Read" (click)="read()">
+ <span>
+ <i class="fa fa-book-open" aria-hidden="true"></i>
+ <span class="read-btn--text">&nbsp;Read</span>
+ </span>
+ </button>
+ </div>
+ <div>
+ <button class="btn btn-secondary" (click)="removeRead()" [disabled]="readingList?.promoted && !this.isAdmin">
+ <span>
+ <i class="fa fa-check"></i>
+ </span>
+ <span class="read-btn--text">&nbsp;Remove Read</span>
+ </button>
+ </div>
+ </div>
+ <p class="mt-2" *ngIf="readingList.summary.length > 0">{{readingList.summary}}</p>
+ </div>
+ </div>
+
+ <div *ngIf="items.length === 0">
+ No chapters added
+ </div>
+
+ <!-- NOTE: It might be nice to have a switch for the accessibility toggle -->
+ <app-dragable-ordered-list [items]="items" (orderUpdated)="orderUpdated($event)" (itemRemove)="itemRemoved($event)">
+ <ng-template #draggableItem let-item let-position="idx">
+ <div class="media" style="width: 100%;">
+ <img width="74px" style="width: 74px;" class="img-top lazyload mr-3" [src]="imageService.placeholderImage" [attr.data-src]="imageService.getChapterCoverImage(item.chapterId)"
+ (error)="imageService.updateErroredImage($event)">
+ <div class="media-body">
+ <h5 class="mt-0 mb-1" id="item.id--{{position}}">{{formatTitle(item)}}</h5>
+ <i class="fa {{utilityService.mangaFormatIcon(item.seriesFormat)}}" aria-hidden="true" *ngIf="item.seriesFormat != MangaFormat.UNKNOWN" title="{{utilityService.mangaFormat(item.seriesFormat)}}"></i><span class="sr-only">{{utilityService.mangaFormat(item.seriesFormat)}}</span>&nbsp;
+ <a href="/library/{{item.libraryId}}/series/{{item.seriesId}}">{{item.seriesName}}</a>
+ <span *ngIf="item.promoted">
+ <i class="fa fa-angle-double-up" aria-hidden="true"></i>
+ </span>
+ </div>
+ <div class="pull-right" *ngIf="item.pagesRead === item.pagesTotal"><i class="fa fa-check-square" aria-label="Read"></i></div>
+ </div>
+ </ng-template>
+ </app-dragable-ordered-list>
+</div>
\ No newline at end of file
diff --git a/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.scss b/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.scss
new file mode 100644
index 000000000..e69de29bb
diff --git a/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.ts b/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.ts
new file mode 100644
index 000000000..6e29c4e22
--- /dev/null
+++ b/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.ts
@@ -0,0 +1,153 @@
+import { Component, OnInit } from '@angular/core';
+import { ActivatedRoute, Router } from '@angular/router';
+import { ToastrService } from 'ngx-toastr';
+import { take } from 'rxjs/operators';
+import { ConfirmService } from 'src/app/shared/confirm.service';
+import { UtilityService } from 'src/app/shared/_services/utility.service';
+import { MangaFormat } from 'src/app/_models/manga-format';
+import { ReadingList, ReadingListItem } from 'src/app/_models/reading-list';
+import { AccountService } from 'src/app/_services/account.service';
+import { Action, ActionFactoryService, ActionItem } from 'src/app/_services/action-factory.service';
+import { ActionService } from 'src/app/_services/action.service';
+import { ImageService } from 'src/app/_services/image.service';
+import { ReaderService } from 'src/app/_services/reader.service';
+import { ReadingListService } from 'src/app/_services/reading-list.service';
+import { IndexUpdateEvent, ItemRemoveEvent } from '../dragable-ordered-list/dragable-ordered-list.component';
+
+@Component({
+ selector: 'app-reading-list-detail',
+ templateUrl: './reading-list-detail.component.html',
+ styleUrls: ['./reading-list-detail.component.scss']
+})
+export class ReadingListDetailComponent implements OnInit {
+
+ items: Array<ReadingListItem> = [];
+ listId!: number;
+ readingList!: ReadingList;
+ actions: Array<ActionItem<any>> = [];
+ isAdmin: boolean = false;
+ isLoading: boolean = false;
+
+ get MangaFormat(): typeof MangaFormat {
+ return MangaFormat;
+ }
+
+ constructor(private route: ActivatedRoute, private router: Router, private readingListService: ReadingListService,
+ private actionService: ActionService, private actionFactoryService: ActionFactoryService, public utilityService: UtilityService,
+ public imageService: ImageService, private accountService: AccountService, private toastr: ToastrService, private confirmService: ConfirmService) {}
+
+ ngOnInit(): void {
+ const listId = this.route.snapshot.paramMap.get('id');
+
+ if (listId === null) {
+ this.router.navigateByUrl('/libraries');
+ return;
+ }
+
+ this.listId = parseInt(listId, 10);
+
+ this.readingListService.getReadingList(this.listId).subscribe(readingList => {
+ if (readingList == null) {
+ // The list doesn't exist
+ this.toastr.error('This list doesn\'t exist.');
+ this.router.navigateByUrl('library');
+ return;
+ }
+ this.readingList = readingList;
+
+ this.accountService.currentUser$.pipe(take(1)).subscribe(user => {
+ if (user) {
+ this.isAdmin = this.accountService.hasAdminRole(user);
+
+ this.actions = this.actionFactoryService.getReadingListActions(this.handleReadingListActionCallback.bind(this)).filter(action => this.readingListService.actionListFilter(action, readingList, this.isAdmin));
+ }
+ });
+ });
+ this.getListItems();
+ }
+
+ getListItems() {
+ this.isLoading = true;
+ this.readingListService.getListItems(this.listId).subscribe(items => {
+ this.items = items;
+ this.isLoading = false;
+ });
+ }
+
+ performAction(action: ActionItem<any>) {
+ // TODO: Try to move performAction into the actionables component. (have default handler in the component, allow for overridding to pass additional context)
+ if (typeof action.callback === 'function') {
+ action.callback(action.action, this.readingList);
+ }
+ }
+
+ handleReadingListActionCallback(action: Action, readingList: ReadingList) {
+ switch(action) {
+ case Action.Delete:
+ this.deleteList(readingList);
+ break;
+ case Action.Edit:
+ this.actionService.editReadingList(readingList, (readingList: ReadingList) => {
+ // Reload information around list
+ this.readingList = readingList;
+ });
+ break;
+ }
+ }
+
+ async deleteList(readingList: ReadingList) {
+ if (!await this.confirmService.confirm('Are you sure you want to delete the reading list? This cannot be undone.')) return;
+
+ this.readingListService.delete(readingList.id).subscribe(() => {
+ this.toastr.success('Reading list deleted');
+ this.router.navigateByUrl('library#lists');
+ });
+ }
+
+ formatTitle(item: ReadingListItem) {
+ if (item.chapterNumber === '0') {
+ return 'Volume ' + item.volumeNumber;
+ }
+
+ if (item.seriesFormat === MangaFormat.EPUB) {
+ return 'Volume ' + this.utilityService.cleanSpecialTitle(item.chapterNumber);
+ }
+
+ return 'Chapter ' + item.chapterNumber;
+ }
+
+ orderUpdated(event: IndexUpdateEvent) {
+ this.readingListService.updatePosition(this.readingList.id, event.item.id, event.fromPosition, event.toPosition).subscribe(() => { /* No Operation */ });
+ }
+
+ itemRemoved(event: ItemRemoveEvent) {
+ this.readingListService.deleteItem(this.readingList.id, event.item.id).subscribe(() => {
+ this.items.splice(event.position, 1);
+ this.toastr.success('Item removed');
+ });
+ }
+
+ removeRead() {
+ this.isLoading = true;
+ this.readingListService.removeRead(this.readingList.id).subscribe(() => {
+ this.getListItems();
+ });
+ }
+
+ read() {
+ let currentlyReadingChapter = this.items[0];
+ for (let i = 0; i < this.items.length; i++) {
+ if (this.items[i].pagesRead >= this.items[i].pagesTotal) {
+ continue;
+ }
+ currentlyReadingChapter = this.items[i];
+ break;
+ }
+
+ if (currentlyReadingChapter.seriesFormat === MangaFormat.EPUB) {
+ this.router.navigate(['library', currentlyReadingChapter.libraryId, 'series', currentlyReadingChapter.seriesId, 'book', currentlyReadingChapter.chapterId], {queryParams: {readingListId: this.readingList.id}});
+ } else {
+ this.router.navigate(['library', currentlyReadingChapter.libraryId, 'series', currentlyReadingChapter.seriesId, 'manga', currentlyReadingChapter.chapterId], {queryParams: {readingListId: this.readingList.id}});
+ }
+ }
+}
diff --git a/UI/Web/src/app/reading-list/reading-list.module.ts b/UI/Web/src/app/reading-list/reading-list.module.ts
new file mode 100644
index 000000000..4f8182b58
--- /dev/null
+++ b/UI/Web/src/app/reading-list/reading-list.module.ts
@@ -0,0 +1,36 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { DragableOrderedListComponent } from './dragable-ordered-list/dragable-ordered-list.component';
+import { ReadingListDetailComponent } from './reading-list-detail/reading-list-detail.component';
+import { ReadingListRoutingModule } from './reading-list.router.module';
+import {DragDropModule} from '@angular/cdk/drag-drop';
+import { AddToListModalComponent } from './_modals/add-to-list-modal/add-to-list-modal.component';
+import { ReactiveFormsModule } from '@angular/forms';
+import { CardsModule } from '../cards/cards.module';
+import { ReadingListsComponent } from './reading-lists/reading-lists.component';
+import { EditReadingListModalComponent } from './_modals/edit-reading-list-modal/edit-reading-list-modal.component';
+
+
+
+@NgModule({
+ declarations: [
+ DragableOrderedListComponent,
+ ReadingListDetailComponent,
+ AddToListModalComponent,
+ ReadingListsComponent,
+ EditReadingListModalComponent
+ ],
+ imports: [
+ CommonModule,
+ ReadingListRoutingModule,
+ ReactiveFormsModule,
+ DragDropModule,
+ CardsModule
+ ],
+ exports: [
+ AddToListModalComponent,
+ ReadingListsComponent,
+ EditReadingListModalComponent
+ ]
+})
+export class ReadingListModule { }
diff --git a/UI/Web/src/app/reading-list/reading-list.router.module.ts b/UI/Web/src/app/reading-list/reading-list.router.module.ts
new file mode 100644
index 000000000..0a30ff09e
--- /dev/null
+++ b/UI/Web/src/app/reading-list/reading-list.router.module.ts
@@ -0,0 +1,24 @@
+import { NgModule } from "@angular/core";
+import { Routes, RouterModule } from "@angular/router";
+import { AuthGuard } from "../_guards/auth.guard";
+import { ReadingListDetailComponent } from "./reading-list-detail/reading-list-detail.component";
+
+const routes: Routes = [
+ {
+ path: '',
+ runGuardsAndResolvers: 'always',
+ canActivate: [AuthGuard], // TODO: Add a guard if they have access to said :id
+ children: [
+ {path: '', component: ReadingListDetailComponent, pathMatch: 'full'},
+ {path: ':id', component: ReadingListDetailComponent, pathMatch: 'full'},
+ // {path: ':id', component: CollectionDetailComponent},
+ ]
+ }
+];
+
+
+@NgModule({
+ imports: [RouterModule.forChild(routes)],
+ exports: [RouterModule]
+})
+export class ReadingListRoutingModule { }
\ No newline at end of file
diff --git a/UI/Web/src/app/reading-list/reading-lists/reading-lists.component.html b/UI/Web/src/app/reading-list/reading-lists/reading-lists.component.html
new file mode 100644
index 000000000..96837060c
--- /dev/null
+++ b/UI/Web/src/app/reading-list/reading-lists/reading-lists.component.html
@@ -0,0 +1,11 @@
+<app-card-detail-layout header="Reading Lists"
+ [isLoading]="loadingLists"
+ [items]="lists"
+ [actions]="actions"
+ [pagination]="pagination"
+ (pageChange)="onPageChange($event)"
+ >
+ <ng-template #cardItem let-item let-position="idx">
+ <app-card-item [title]="item.title" [entity]="item" [actions]="getActions(item)" [supressLibraryLink]="true" [imageUrl]="imageService.placeholderImage" (clicked)="handleClick(item)"></app-card-item>
+ </ng-template>
+</app-card-detail-layout>
diff --git a/UI/Web/src/app/reading-list/reading-lists/reading-lists.component.scss b/UI/Web/src/app/reading-list/reading-lists/reading-lists.component.scss
new file mode 100644
index 000000000..e69de29bb
diff --git a/UI/Web/src/app/reading-list/reading-lists/reading-lists.component.ts b/UI/Web/src/app/reading-list/reading-lists/reading-lists.component.ts
new file mode 100644
index 000000000..7b90d0cfb
--- /dev/null
+++ b/UI/Web/src/app/reading-list/reading-lists/reading-lists.component.ts
@@ -0,0 +1,88 @@
+import { Component, OnInit } from '@angular/core';
+import { Router } from '@angular/router';
+import { ToastrService } from 'ngx-toastr';
+import { take } from 'rxjs/operators';
+import { PaginatedResult, Pagination } from 'src/app/_models/pagination';
+import { ReadingList } from 'src/app/_models/reading-list';
+import { AccountService } from 'src/app/_services/account.service';
+import { Action, ActionFactoryService, ActionItem } from 'src/app/_services/action-factory.service';
+import { ImageService } from 'src/app/_services/image.service';
+import { ReadingListService } from 'src/app/_services/reading-list.service';
+
+@Component({
+ selector: 'app-reading-lists',
+ templateUrl: './reading-lists.component.html',
+ styleUrls: ['./reading-lists.component.scss']
+})
+export class ReadingListsComponent implements OnInit {
+
+ lists: ReadingList[] = [];
+ loadingLists = false;
+ pagination!: Pagination;
+ actions: ActionItem<ReadingList>[] = [];
+ isAdmin: boolean = false;
+
+ constructor(private readingListService: ReadingListService, public imageService: ImageService, private actionFactoryService: ActionFactoryService,
+ private accountService: AccountService, private toastr: ToastrService, private router: Router) { }
+
+ ngOnInit(): void {
+ this.loadPage();
+
+ this.accountService.currentUser$.pipe(take(1)).subscribe(user => {
+ if (user) {
+ this.isAdmin = this.accountService.hasAdminRole(user);
+ }
+ });
+ }
+
+ getActions(readingList: ReadingList) {
+ return this.actionFactoryService.getReadingListActions(this.handleReadingListActionCallback.bind(this)).filter(action => this.readingListService.actionListFilter(action, readingList, this.isAdmin));
+ }
+
+ performAction(action: ActionItem<any>, readingList: ReadingList) {
+ // TODO: Try to move performAction into the actionables component. (have default handler in the component, allow for overridding to pass additional context)
+ if (typeof action.callback === 'function') {
+ action.callback(action.action, readingList);
+ }
+ }
+
+ handleReadingListActionCallback(action: Action, readingList: ReadingList) {
+ switch(action) {
+ case Action.Delete:
+ this.readingListService.delete(readingList.id).subscribe(() => {
+ this.toastr.success('Reading list deleted');
+ this.loadPage();
+ });
+ }
+ }
+
+ getPage() {
+ const urlParams = new URLSearchParams(window.location.search);
+ return urlParams.get('page');
+ }
+
+ loadPage() {
+ const page = this.getPage();
+ if (page != null) {
+ this.pagination.currentPage = parseInt(page, 10);
+ }
+ this.loadingLists = true;
+
+ this.readingListService.getReadingLists(true, this.pagination?.currentPage, this.pagination?.itemsPerPage).pipe(take(1)).subscribe((readingLists: PaginatedResult<ReadingList[]>) => {
+ this.lists = readingLists.result;
+ this.pagination = readingLists.pagination;
+ this.loadingLists = false;
+ window.scrollTo(0, 0);
+ });
+ }
+
+ onPageChange(pagination: Pagination) {
+ window.history.replaceState(window.location.href, '', window.location.href.split('?')[0] + '?page=' + this.pagination.currentPage);
+ this.loadPage();
+ }
+
+ handleClick(list: ReadingList) {
+ this.router.navigateByUrl('lists/' + list.id);
+ }
+
+}
diff --git a/UI/Web/src/app/series-detail/series-detail.component.html b/UI/Web/src/app/series-detail/series-detail.component.html
index 7976265d5..37980b5ad 100644
--- a/UI/Web/src/app/series-detail/series-detail.component.html
+++ b/UI/Web/src/app/series-detail/series-detail.component.html
@@ -99,7 +99,7 @@
<div>
- <ul ngbNav #nav="ngbNav" [(activeId)]="activeTabId" class="nav-tabs" [destroyOnHide]="false">
+ <ul ngbNav #nav="ngbNav" [(activeId)]="activeTabId" class="nav-tabs nav-pills" [destroyOnHide]="false">
<li [ngbNavItem]="1" *ngIf="hasSpecials">
<a ngbNavLink>Specials</a>
<ng-template ngbNavContent>
diff --git a/UI/Web/src/app/series-detail/series-detail.component.ts b/UI/Web/src/app/series-detail/series-detail.component.ts
index 969f6f3e9..254c32d81 100644
--- a/UI/Web/src/app/series-detail/series-detail.component.ts
+++ b/UI/Web/src/app/series-detail/series-detail.component.ts
@@ -159,6 +159,9 @@ export class SeriesDetailComponent implements OnInit {
case(Action.Bookmarks):
this.actionService.openBookmarkModal(series, () => this.actionInProgress = false);
break;
+ case(Action.AddToReadingList):
+ this.actionService.addSeriesToReadingList(series, () => this.actionInProgress = false);
+ break;
default:
break;
}
@@ -175,6 +178,9 @@ export class SeriesDetailComponent implements OnInit {
case(Action.Edit):
this.openViewInfo(volume);
break;
+ case(Action.AddToReadingList):
+ this.actionService.addVolumeToReadingList(volume, this.series.id, () => {/* No Operation */ });
+ break;
case(Action.IncognitoRead):
if (volume.chapters != undefined && volume.chapters?.length >= 1) {
this.openChapter(volume.chapters[0], true);
@@ -196,6 +202,9 @@ export class SeriesDetailComponent implements OnInit {
case(Action.Edit):
this.openViewInfo(chapter);
break;
+ case(Action.AddToReadingList):
+ this.actionService.addChapterToReadingList(chapter, this.series.id, () => {/* No Operation */ });
+ break;
case(Action.IncognitoRead):
this.openChapter(chapter, true);
break;
diff --git a/UI/Web/src/app/shared/shared.module.ts b/UI/Web/src/app/shared/shared.module.ts
index 790333aa8..246d9363c 100644
--- a/UI/Web/src/app/shared/shared.module.ts
+++ b/UI/Web/src/app/shared/shared.module.ts
@@ -13,7 +13,6 @@ import { ShowIfScrollbarDirective } from './show-if-scrollbar.directive';
import { A11yClickDirective } from './a11y-click.directive';
import { SeriesFormatComponent } from './series-format/series-format.component';
import { UpdateNotificationModalComponent } from './update-notification/update-notification-modal.component';
-import { SAVER, getSaver } from './_providers/saver.provider';
import { CircularLoaderComponent } from './circular-loader/circular-loader.component';
import { NgCircleProgressModule } from 'ng-circle-progress';
@@ -51,6 +50,5 @@ import { NgCircleProgressModule } from 'ng-circle-progress';
TagBadgeComponent,
CircularLoaderComponent,
],
- //providers: [{provide: SAVER, useFactory: getSaver}]
})
export class SharedModule { }
diff --git a/UI/Web/src/app/user-settings/user-preferences/user-preferences.component.html b/UI/Web/src/app/user-settings/user-preferences/user-preferences.component.html
index ed5078041..b407d5a56 100644
--- a/UI/Web/src/app/user-settings/user-preferences/user-preferences.component.html
+++ b/UI/Web/src/app/user-settings/user-preferences/user-preferences.component.html
@@ -1,6 +1,6 @@
<div class="container">
<h2>User Dashboard</h2>
- <ul ngbNav #nav="ngbNav" [(activeId)]="active" class="nav-tabs">
+ <ul ngbNav #nav="ngbNav" [(activeId)]="active" class="nav-tabs nav-pills">
<li *ngFor="let tab of tabs" [ngbNavItem]="tab">
<a ngbNavLink routerLink="." [fragment]="tab.fragment">{{ tab.title | titlecase }}</a>
<ng-template ngbNavContent>
@@ -9,8 +9,14 @@
These are global settings that are bound to your account.
</p>
- <ngb-accordion [closeOthers]="true" activeIds="site-panel">
+ <ngb-accordion [closeOthers]="true" activeIds="site-panel" #acc="ngbAccordion">
<ngb-panel id="site-panel" title="Site">
+ <ng-template ngbPanelHeader>
+ <div class="d-flex align-items-center justify-content-between">
+ <button ngbPanelToggle class="btn container-fluid text-left pl-0 accordion-header">Site</button>
+ <span class="pull-right"><i class="fa fa-angle-{{acc.isExpanded('site-panel') ? 'down' : 'up'}}" aria-hidden="true"></i></span>
+ </div>
+ </ng-template>
<ng-template ngbPanelContent>
<form [formGroup]="settingsForm" *ngIf="user !== undefined">
<div class="form-group">
@@ -34,6 +40,12 @@
</ng-template>
</ngb-panel>
<ngb-panel id="reading-panel" title="Reading">
+ <ng-template ngbPanelHeader>
+ <div class="d-flex align-items-center justify-content-between">
+ <button ngbPanelToggle class="btn container-fluid text-left pl-0 accordion-header">Reading</button>
+ <span class="pull-right"><i class="fa fa-angle-{{acc.isExpanded('reading-panel') ? 'down' : 'up'}}" aria-hidden="true"></i></span>
+ </div>
+ </ng-template>
<ng-template ngbPanelContent>
<form [formGroup]="settingsForm" *ngIf="user !== undefined">
<h3 id="manga-header">Manga</h3>
@@ -156,6 +168,12 @@
<ngb-panel id="password-panel" title="Password">
+ <ng-template ngbPanelHeader>
+ <div class="d-flex align-items-center justify-content-between">
+ <button ngbPanelToggle class="btn container-fluid text-left pl-0 accordion-header">Password</button>
+ <span class="pull-right"><i class="fa fa-angle-{{acc.isExpanded('password-panel') ? 'down' : 'up'}}" aria-hidden="true"></i></span>
+ </div>
+ </ng-template>
<ng-template ngbPanelContent>
<p>Change your Password</p>
<div class="alert alert-danger" role="alert" *ngIf="resetPasswordErrors.length > 0">
@@ -191,6 +209,12 @@
</ng-template>
</ngb-panel>
<ngb-panel id="api-panel" title="OPDS">
+ <ng-template ngbPanelHeader>
+ <div class="d-flex align-items-center justify-content-between">
+ <button ngbPanelToggle class="btn container-fluid text-left pl-0 accordion-header">OPDS</button>
+ <span class="pull-right"><i class="fa fa-angle-{{acc.isExpanded('api-panel') ? 'down' : 'up'}}" aria-hidden="true"></i></span>
+ </div>
+ </ng-template>
<ng-template ngbPanelContent>
<p class="alert alert-danger" role="alert" *ngIf="!opdsEnabled">
OPDS is not enabled on this server!
diff --git a/UI/Web/src/assets/themes/dark.scss b/UI/Web/src/assets/themes/dark.scss
index 62e5b1c94..1cb16255b 100644
--- a/UI/Web/src/assets/themes/dark.scss
+++ b/UI/Web/src/assets/themes/dark.scss
@@ -30,6 +30,11 @@ $dark-item-accent-bg: #292d32;
color: white;
}
+ .accordion-header {
+ font-weight: bold;
+ color: $dark-primary-color;
+ }
+
.accent {
background-color: $dark-form-background !important;