mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-11-21 16:11:33 +01:00
Fix library narrator update/delete endpoint to be library scoped
This commit is contained in:
1 parent
3b4895b1b0
commit
fb43db4f75
3 files changed
+16
-16
No files matched your search
@@ -133,9 +133,10 @@ module.exports = {
|
||||
/**
|
||||
* Get all library items that have narrators
|
||||
* @param {string[]} narrators
|
||||
* @param {string} libraryId
|
||||
* @returns {Promise<import('../../models/LibraryItem')[]>}
|
||||
*/
|
||||
async getAllLibraryItemsWithNarrators(narrators) {
|
||||
async getAllLibraryItemsWithNarrators(narrators, libraryId) {
|
||||
const libraryItems = []
|
||||
const booksWithGenre = await Database.bookModel.findAll({
|
||||
where: Sequelize.where(Sequelize.literal(`(SELECT count(*) FROM json_each(narrators) WHERE json_valid(narrators) AND json_each.value IN (:narrators))`), {
|
||||
@@ -146,7 +147,8 @@ module.exports = {
|
||||
},
|
||||
include: [
|
||||
{
|
||||
model: Database.libraryItemModel
|
||||
model: Database.libraryItemModel,
|
||||
where: { libraryId }
|
||||
},
|
||||
{
|
||||
model: Database.authorModel,
|
||||
|
||||
Reference in new issue
Block a user