mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-13 10:55:05 +02:00
Fix discover home page shelf query, add indexes for libraryItems and mediaProgresses table
This commit is contained in:
parent
33e04d0cbb
commit
8c9fc3ddb5
4 changed files with 56 additions and 19 deletions
|
@ -448,7 +448,10 @@ module.exports = (sequelize) => {
|
|||
* @returns {object} { libraryItems:oldLibraryItem[], count:number }
|
||||
*/
|
||||
static async getByFilterAndSort(library, user, options) {
|
||||
let start = Date.now()
|
||||
const { libraryItems, count } = await libraryFilters.getFilteredLibraryItems(library, user, options)
|
||||
Logger.debug(`Loaded ${libraryItems.length} of ${count} items for libary page in ${((Date.now() - start) / 1000).toFixed(2)}s`)
|
||||
|
||||
return {
|
||||
libraryItems: libraryItems.map(li => {
|
||||
const oldLibraryItem = this.getOldLibraryItem(li).toJSONMinified()
|
||||
|
@ -692,7 +695,15 @@ module.exports = (sequelize) => {
|
|||
extraData: DataTypes.JSON
|
||||
}, {
|
||||
sequelize,
|
||||
modelName: 'libraryItem'
|
||||
modelName: 'libraryItem',
|
||||
indexes: [
|
||||
{
|
||||
fields: ['createdAt']
|
||||
},
|
||||
{
|
||||
fields: ['mediaId']
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
const { library, libraryFolder, book, podcast } = sequelize.models
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue