mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-24 21:04:33 +02:00
Update:Get personalized home page shelves and get library items endpoint optional includes for media item shares, show public icon on shared book items
This commit is contained in:
parent
134c2580c9
commit
d5e00c8bbd
7 changed files with 117 additions and 79 deletions
|
@ -10,6 +10,8 @@ const LibraryFile = require('../objects/files/LibraryFile')
|
|||
const Book = require('./Book')
|
||||
const Podcast = require('./Podcast')
|
||||
|
||||
const ShareManager = require('../managers/ShareManager')
|
||||
|
||||
/**
|
||||
* @typedef LibraryFileObject
|
||||
* @property {string} ino
|
||||
|
@ -537,7 +539,7 @@ class LibraryItem extends Model {
|
|||
* @param {oldLibrary} library
|
||||
* @param {oldUser} user
|
||||
* @param {object} options
|
||||
* @returns {object} { libraryItems:oldLibraryItem[], count:number }
|
||||
* @returns {{ libraryItems:oldLibraryItem[], count:number }}
|
||||
*/
|
||||
static async getByFilterAndSort(library, user, options) {
|
||||
let start = Date.now()
|
||||
|
@ -565,6 +567,10 @@ class LibraryItem extends Model {
|
|||
if (li.numEpisodesIncomplete) {
|
||||
oldLibraryItem.numEpisodesIncomplete = li.numEpisodesIncomplete
|
||||
}
|
||||
if (li.mediaType === 'book' && options.include?.includes?.('share')) {
|
||||
console.log('Lookup share for media item id', li.mediaId)
|
||||
oldLibraryItem.mediaItemShare = ShareManager.findByMediaItemId(li.mediaId)
|
||||
}
|
||||
|
||||
return oldLibraryItem
|
||||
}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue