Fix library narrator update/delete endpoint to be library scoped

This commit is contained in:
advplyr committed 2026-09-15 16:21:22 -05:00
1 parent 3b4895b1b0
commit fb43db4f75
3 files changed
+16 -16

No files matched your search

+4 -2
View File
@@ -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,