Fix:Crash when updating sequence on series #1919

This commit is contained in:
advplyr 2023-07-17 08:09:08 -05:00
parent b715ef3bfc
commit d0cd512be8
2 changed files with 3 additions and 2 deletions

View File

@ -100,6 +100,7 @@ class LibraryItemController {
async updateMedia(req, res) { async updateMedia(req, res) {
const libraryItem = req.libraryItem const libraryItem = req.libraryItem
const mediaPayload = req.body const mediaPayload = req.body
// Item has cover and update is removing cover so purge it from cache // Item has cover and update is removing cover so purge it from cache
if (libraryItem.media.coverPath && (mediaPayload.coverPath === '' || mediaPayload.coverPath === null)) { if (libraryItem.media.coverPath && (mediaPayload.coverPath === '' || mediaPayload.coverPath === null)) {
await this.cacheManager.purgeCoverCache(libraryItem.id) await this.cacheManager.purgeCoverCache(libraryItem.id)

View File

@ -119,7 +119,7 @@ module.exports = (sequelize) => {
{ {
model: sequelize.models.series, model: sequelize.models.series,
through: { through: {
attributes: ['sequence'] attributes: ['id', 'sequence']
} }
} }
] ]
@ -220,7 +220,7 @@ module.exports = (sequelize) => {
hasUpdates = true hasUpdates = true
} else if (existingSeriesMatch.bookSeries.sequence !== updatedSeries.sequence) { } else if (existingSeriesMatch.bookSeries.sequence !== updatedSeries.sequence) {
Logger.dev(`[LibraryItem] "${libraryItemExpanded.media.title}" series "${updatedSeries.name}" sequence was updated from "${existingSeriesMatch.bookSeries.sequence}" to "${updatedSeries.sequence}"`) Logger.dev(`[LibraryItem] "${libraryItemExpanded.media.title}" series "${updatedSeries.name}" sequence was updated from "${existingSeriesMatch.bookSeries.sequence}" to "${updatedSeries.sequence}"`)
await existingSeriesMatch.bookSeries.update({ sequence: updatedSeries.sequence }) await existingSeriesMatch.bookSeries.update({ id: updatedSeries.id, sequence: updatedSeries.sequence })
hasUpdates = true hasUpdates = true
} }
} }