mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-28 03:30:37 +02:00
Update library items batch get route
This commit is contained in:
parent
3c0fdff7b4
commit
0ae853c119
3 changed files with 21 additions and 15 deletions
|
@ -308,17 +308,17 @@ class LibraryItemController {
|
|||
|
||||
// POST: api/items/batch/get
|
||||
async batchGet(req, res) {
|
||||
var libraryItemIds = req.body.libraryItemIds || []
|
||||
const libraryItemIds = req.body.libraryItemIds || []
|
||||
if (!libraryItemIds.length) {
|
||||
return res.status(403).send('Invalid payload')
|
||||
}
|
||||
var libraryItems = []
|
||||
const libraryItems = []
|
||||
libraryItemIds.forEach((lid) => {
|
||||
const li = this.db.libraryItems.find(_li => _li.id === lid)
|
||||
if (li) libraryItems.push(li.toJSONExpanded())
|
||||
})
|
||||
res.json({
|
||||
libraryItems: libraryItems
|
||||
libraryItems
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue