mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-21 16:39:13 +02:00
Fix:Remove collections when removing library
This commit is contained in:
parent
6f901defd6
commit
28feed6ea2
6 changed files with 55 additions and 38 deletions
|
@ -131,6 +131,13 @@ class LibraryController {
|
|||
// Remove library watcher
|
||||
this.watcher.removeLibrary(library)
|
||||
|
||||
// Remove collections for library
|
||||
var collections = this.db.collections.filter(c => c.libraryId === library.id)
|
||||
for (const collection of collections) {
|
||||
Logger.info(`[Server] deleting collection "${collection.name}" for library "${library.name}"`)
|
||||
await this.db.removeEntity('collection', collection.id)
|
||||
}
|
||||
|
||||
// Remove items in this library
|
||||
var libraryItems = this.db.libraryItems.filter(li => li.libraryId === library.id)
|
||||
Logger.info(`[Server] deleting library "${library.name}" with ${libraryItems.length} items"`)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue