2020-01-14 23:26:39 +01:00
|
|
|
module.exports = models => {
|
|
|
|
const {
|
|
|
|
ShelfItem,
|
|
|
|
Shelf,
|
|
|
|
BookReference,
|
|
|
|
Status,
|
|
|
|
} = models;
|
|
|
|
|
|
|
|
ShelfItem.belongsTo(Shelf, {
|
|
|
|
foreignKey: 'shelfId',
|
|
|
|
onDelete: 'CASCADE',
|
|
|
|
});
|
|
|
|
|
|
|
|
ShelfItem.belongsTo(BookReference, {
|
|
|
|
foreignKey: 'bookId',
|
|
|
|
onDelete: 'CASCADE',
|
|
|
|
});
|
|
|
|
|
2020-01-25 21:52:37 +01:00
|
|
|
ShelfItem.hasMany(Status, {
|
|
|
|
foreignKey: 'shelfItemId',
|
|
|
|
});
|
2020-01-14 23:26:39 +01:00
|
|
|
|
|
|
|
return ShelfItem;
|
|
|
|
}
|