diff --git a/server/controllers/MiscController.js b/server/controllers/MiscController.js index d9c1c445..f3dd0c6d 100644 --- a/server/controllers/MiscController.js +++ b/server/controllers/MiscController.js @@ -44,7 +44,7 @@ class MiscController { const files = Object.values(req.files) const { title, author, series, folder: folderId, library: libraryId } = req.body - const library = await Database.libraryModel.findByPk(libraryId) + const library = await Database.libraryModel.findByIdWithFolders(libraryId) if (!library) { return res.status(404).send(`Library not found with id ${libraryId}`) } diff --git a/server/controllers/PodcastController.js b/server/controllers/PodcastController.js index 976e1ac9..3610c2ea 100644 --- a/server/controllers/PodcastController.js +++ b/server/controllers/PodcastController.js @@ -38,7 +38,7 @@ class PodcastController { } const payload = req.body - const library = await Database.libraryModel.findByPk(payload.libraryId) + const library = await Database.libraryModel.findByIdWithFolders(payload.libraryId) if (!library) { Logger.error(`[PodcastController] Create: Library not found "${payload.libraryId}"`) return res.status(404).send('Library not found')