mirror of
https://github.com/Kareadita/Kavita.git
synced 2026-05-28 10:32:34 -04:00
Cleanup bookmarks and Reading List Items (#567)
* Removed directives, ensured we delete bookmarks and reading list items when chapters are deleted. * Added parsing support for "Kimi no Koto ga Daidaidaidaidaisuki na 100-nin no Kanojo Chapter 11-10"
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using API.Entities.Enums;
|
||||
using API.Interfaces;
|
||||
using API.Interfaces.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
@@ -27,7 +26,17 @@ namespace API.Data.Repositories
|
||||
.Where(progress => !chapterIds.Contains(progress.ChapterId))
|
||||
.ToListAsync();
|
||||
|
||||
var rowsToRemoveBookmarks = await _context.AppUserBookmark
|
||||
.Where(progress => !chapterIds.Contains(progress.ChapterId))
|
||||
.ToListAsync();
|
||||
|
||||
var rowsToRemoveReadingLists = await _context.ReadingListItem
|
||||
.Where(item => !chapterIds.Contains(item.ChapterId))
|
||||
.ToListAsync();
|
||||
|
||||
_context.RemoveRange(rowsToRemove);
|
||||
_context.RemoveRange(rowsToRemoveBookmarks);
|
||||
_context.RemoveRange(rowsToRemoveReadingLists);
|
||||
return await _context.SaveChangesAsync() > 0 ? rowsToRemove.Count : 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user