Update:Only load collections when needed

This commit is contained in:
advplyr 2023-07-22 16:18:55 -05:00
parent 354e16e462
commit 5a9eed0a5a
8 changed files with 87 additions and 24 deletions

View file

@ -19,7 +19,6 @@ class Database {
// TODO: below data should be loaded from the DB as needed
this.libraryItems = []
this.settings = []
this.collections = []
this.playlists = []
this.authors = []
this.series = []
@ -161,9 +160,6 @@ class Database {
this.libraryItems = await this.models.libraryItem.loadAllLibraryItems()
Logger.info(`[Database] Loaded ${this.libraryItems.length} library items`)
this.collections = await this.models.collection.getOldCollections()
Logger.info(`[Database] Loaded ${this.collections.length} collections`)
this.playlists = await this.models.playlist.getOldPlaylists()
Logger.info(`[Database] Loaded ${this.playlists.length} playlists`)
@ -280,7 +276,6 @@ class Database {
await this.createBulkCollectionBooks(collectionBooks)
}
}
this.collections.push(oldCollection)
}
updateCollection(oldCollection) {
@ -302,7 +297,6 @@ class Database {
async removeCollection(collectionId) {
if (!this.sequelize) return false
await this.models.collection.removeById(collectionId)
this.collections = this.collections.filter(c => c.id !== collectionId)
}
createCollectionBook(collectionBook) {