Fix:New authors not setting lastFirst column, updates for new Series model

This commit is contained in:
advplyr 2024-09-01 15:08:56 -05:00
parent 7ff72a8920
commit db86bfd63d
14 changed files with 234 additions and 225 deletions

View file

@ -104,6 +104,9 @@ class AuthorController {
let hasUpdated = false
const authorNameUpdate = payload.name !== undefined && payload.name !== req.author.name
if (authorNameUpdate) {
payload.lastFirst = Database.authorModel.getLastFirst(payload.name)
}
// Check if author name matches another author and merge the authors
let existingAuthor = null
@ -169,6 +172,11 @@ class AuthorController {
return
}
// If lastFirst is not set, get it from the name
if (!authorNameUpdate && !req.author.lastFirst) {
payload.lastFirst = Database.authorModel.getLastFirst(req.author.name)
}
// Regular author update
req.author.set(payload)
if (req.author.changed()) {