mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-23 17:29:19 +02:00
Update:Fetch library API to return numUserPlaylists, only display playlists in siderail if user has playlists
This commit is contained in:
parent
0fcf978ffe
commit
083f8faa46
3 changed files with 16 additions and 5 deletions
|
@ -62,10 +62,12 @@ class LibraryController {
|
|||
}
|
||||
|
||||
async findOne(req, res) {
|
||||
if (req.query.include && req.query.include === 'filterdata') {
|
||||
const includeArray = (req.query.include || '').split(',')
|
||||
if (includeArray.includes('filterdata')) {
|
||||
return res.json({
|
||||
filterdata: libraryHelpers.getDistinctFilterDataNew(req.libraryItems),
|
||||
issues: req.libraryItems.filter(li => li.hasIssues).length,
|
||||
numUserPlaylists: this.db.playlists.filter(p => p.userId === req.user.id && p.libraryId === req.library.id).length,
|
||||
library: req.library
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue