mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-16 00:39:40 +00:00
Update collection API routes to load libraryItems from DB
This commit is contained in:
parent
38029d1202
commit
db80cec168
8 changed files with 344 additions and 139 deletions
|
|
@ -882,24 +882,25 @@ module.exports = {
|
|||
Logger.error(`[libraryItemsBookFilters] Invalid collection`, collection)
|
||||
return []
|
||||
}
|
||||
|
||||
const books = await Database.models.book.findAll({
|
||||
where: {
|
||||
id: {
|
||||
[Sequelize.Op.in]: collection.books
|
||||
}
|
||||
},
|
||||
include: [
|
||||
{
|
||||
model: Database.models.libraryItem
|
||||
model: Database.models.libraryItem,
|
||||
where: {
|
||||
id: {
|
||||
[Sequelize.Op.in]: collection.books
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
model: sequelize.models.author,
|
||||
model: Database.models.author,
|
||||
through: {
|
||||
attributes: []
|
||||
}
|
||||
},
|
||||
{
|
||||
model: sequelize.models.series,
|
||||
model: Database.models.series,
|
||||
through: {
|
||||
attributes: ['sequence']
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue