mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-24 04:44:57 +02:00
Improve page load queries on title, titleIgnorePrefix, and addedAt sort order
This commit is contained in:
parent
52bb28669a
commit
a13143245b
6 changed files with 363 additions and 9 deletions
|
@ -3,6 +3,7 @@ const Logger = require('../Logger')
|
|||
const { getTitlePrefixAtEnd, getTitleIgnorePrefix } = require('../utils')
|
||||
const parseNameString = require('../utils/parsers/parseNameString')
|
||||
const htmlSanitizer = require('../utils/htmlSanitizer')
|
||||
const libraryItemsBookFilters = require('../utils/queries/libraryItemsBookFilters')
|
||||
|
||||
/**
|
||||
* @typedef EBookFileObject
|
||||
|
@ -192,6 +193,14 @@ class Book extends Model {
|
|||
]
|
||||
}
|
||||
)
|
||||
|
||||
Book.addHook('afterDestroy', async (instance) => {
|
||||
libraryItemsBookFilters.clearCountCache('afterDestroy ')
|
||||
})
|
||||
|
||||
Book.addHook('afterCreate', async (instance) => {
|
||||
libraryItemsBookFilters.clearCountCache('afterCreate')
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue