fix: refresh series metadata and aggregation after book deletion

in some cases the series metadata and aggregation could be incorrect after a book deletion
This commit is contained in:
Gauthier Roebroeck 2021-03-22 15:06:50 +08:00
parent d570deba4c
commit 9e4443765b

View file

@ -21,7 +21,8 @@ class LibraryContentLifecycle(
private val bookRepository: BookRepository,
private val bookLifecycle: BookLifecycle,
private val mediaRepository: MediaRepository,
private val seriesLifecycle: SeriesLifecycle
private val seriesLifecycle: SeriesLifecycle,
private val taskReceiver: TaskReceiver,
) {
fun scanRootFolder(library: Library) {
@ -101,6 +102,7 @@ class LibraryContentLifecycle(
.let { books ->
logger.info { "Deleting books not on disk anymore: $books" }
bookLifecycle.deleteMany(books.map { it.id })
books.map { it.seriesId }.distinct().forEach { taskReceiver.refreshSeriesMetadata(it) }
}
// add new books