ComicInfo Derived Reading Lists (#1929)

* Implemented the ability to generate reading lists from StoryArc and StoryArcNumber ComicInfo fields.

* Refactored to add AlternativeSeries support.

* Fixed up the handling when we need to update reading list where order is already present.

* Refactored how skipping empty reading list pairs works
This commit is contained in:
Joe Milazzo 2023-04-15 10:28:49 -05:00 committed by GitHub
parent 1e535d27fa
commit 7f53eadfda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 2061 additions and 41 deletions

View file

@ -48,6 +48,7 @@ public interface IReadingListRepository
Task<IList<ReadingList>> GetAllWithNonWebPCovers();
Task<IList<string>> GetFirstFourCoverImagesByReadingListId(int readingListId);
Task<int> RemoveReadingListsWithoutSeries();
Task<ReadingList?> GetReadingListByTitleAsync(string name, int userId, ReadingListIncludes includes = ReadingListIncludes.Items);
}
public class ReadingListRepository : IReadingListRepository
@ -145,6 +146,15 @@ public class ReadingListRepository : IReadingListRepository
return await _context.SaveChangesAsync();
}
public async Task<ReadingList?> GetReadingListByTitleAsync(string name, int userId, ReadingListIncludes includes = ReadingListIncludes.Items)
{
var normalized = name.ToNormalized();
return await _context.ReadingList
.Includes(includes)
.FirstOrDefaultAsync(x => x.NormalizedTitle != null && x.NormalizedTitle.Equals(normalized) && x.AppUserId == userId);
}
public void Remove(ReadingListItem item)
{
_context.ReadingListItem.Remove(item);