mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-04-04 14:19:43 +00:00
Emit proper author_updated/added events when updating book media
This commit is contained in:
parent
5de92d08f9
commit
093124aac6
2 changed files with 15 additions and 3 deletions
|
|
@ -115,12 +115,13 @@ class Author extends Model {
|
|||
*/
|
||||
static async findOrCreateByNameAndLibrary(name, libraryId) {
|
||||
const author = await this.getByNameAndLibrary(name, libraryId)
|
||||
if (author) return author
|
||||
return this.create({
|
||||
if (author) return { author, created: false }
|
||||
const newAuthor = await this.create({
|
||||
name,
|
||||
lastFirst: this.getLastFirst(name),
|
||||
libraryId
|
||||
})
|
||||
return { author: newAuthor, created: true }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue