mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-22 03:44:28 +02:00
Fix direct access to Database.libraryFilterData
This commit is contained in:
parent
0d9d2fa4be
commit
0e8148001e
2 changed files with 19 additions and 5 deletions
|
@ -430,7 +430,7 @@ class Database {
|
|||
await oldLibraryItem.saveMetadata()
|
||||
const updated = await this.models.libraryItem.fullUpdateFromOld(oldLibraryItem)
|
||||
// Clear library filter data cache
|
||||
if (updated) {
|
||||
if (updated) {
|
||||
delete this.libraryFilterData[oldLibraryItem.libraryId]
|
||||
}
|
||||
return updated
|
||||
|
@ -689,6 +689,20 @@ class Database {
|
|||
return this.libraryFilterData[libraryId].series.some(se => se.id === seriesId)
|
||||
}
|
||||
|
||||
async getAuthorByName(libraryId, authorName) {
|
||||
if (!this.libraryFilterData[libraryId]) {
|
||||
return await this.authorModel.getOldByNameAndLibrary(authorName, libraryId)
|
||||
}
|
||||
return this.libraryFilterData[libraryId].authors.find(au => au.name === authorName)
|
||||
}
|
||||
|
||||
async getSeriesByName(libraryId, seriesName) {
|
||||
if (!this.libraryFilterData[libraryId]) {
|
||||
return await this.seriesModel.getOldByNameAndLibrary(seriesName, libraryId)
|
||||
}
|
||||
return this.libraryFilterData[libraryId].series.find(se => se.name === seriesName)
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset numIssues for library
|
||||
* @param {string} libraryId
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue