mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-24 21:04:33 +02:00
Update share endpoint to return playback session, add get share file endpoint
This commit is contained in:
parent
042035051d
commit
8cadaa57f6
6 changed files with 161 additions and 12 deletions
|
@ -44,6 +44,41 @@ class MediaItemShare extends Model {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} mediaItemId
|
||||
* @param {string} mediaItemType
|
||||
* @returns {Promise<import('../objects/LibraryItem')>}
|
||||
*/
|
||||
static async getMediaItemsOldLibraryItem(mediaItemId, mediaItemType) {
|
||||
if (mediaItemType === 'book') {
|
||||
const book = await this.sequelize.models.book.findByPk(mediaItemId, {
|
||||
include: [
|
||||
{
|
||||
model: this.sequelize.models.author,
|
||||
through: {
|
||||
attributes: []
|
||||
}
|
||||
},
|
||||
{
|
||||
model: this.sequelize.models.series,
|
||||
through: {
|
||||
attributes: ['sequence']
|
||||
}
|
||||
},
|
||||
{
|
||||
model: this.sequelize.models.libraryItem
|
||||
}
|
||||
]
|
||||
})
|
||||
const libraryItem = book.libraryItem
|
||||
libraryItem.media = book
|
||||
delete book.libraryItem
|
||||
return this.sequelize.models.libraryItem.getOldLibraryItem(libraryItem)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {import('sequelize').FindOptions} options
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue