Add:Remove option for authors & show authors with 0 books on authors page #2124

This commit is contained in:
advplyr 2023-09-24 17:06:32 -05:00
parent 0367d9ec2a
commit 10011d3886
19 changed files with 79 additions and 5 deletions

View file

@ -47,10 +47,14 @@ class BookAuthor extends Model {
book.belongsToMany(author, { through: BookAuthor })
author.belongsToMany(book, { through: BookAuthor })
book.hasMany(BookAuthor)
book.hasMany(BookAuthor, {
onDelete: 'CASCADE'
})
BookAuthor.belongsTo(book)
author.hasMany(BookAuthor)
author.hasMany(BookAuthor, {
onDelete: 'CASCADE'
})
BookAuthor.belongsTo(author)
}
}