Readlebee/server/sequelize/associations/ShelfItem.js

22 lines
349 B
JavaScript
Raw Normal View History

module.exports = models => {
const {
ShelfItem,
Shelf,
BookReference,
Status,
} = models;
ShelfItem.belongsTo(Shelf, {
foreignKey: 'shelfId',
onDelete: 'CASCADE',
});
ShelfItem.belongsTo(BookReference, {
foreignKey: 'bookId',
onDelete: 'CASCADE',
});
ShelfItem.hasMany(Status);
return ShelfItem;
}