2020-01-14 23:26:39 +01:00
|
|
|
module.exports = models => {
|
|
|
|
const {
|
|
|
|
BookReference,
|
|
|
|
Review,
|
|
|
|
} = models;
|
|
|
|
|
2020-01-25 21:52:37 +01:00
|
|
|
BookReference.hasMany(Review, {
|
2020-02-07 01:27:45 +01:00
|
|
|
as: 'Interactions',
|
|
|
|
foreignKey: 'bookReferenceId',
|
|
|
|
});
|
|
|
|
|
|
|
|
BookReference.hasMany(Review.scope('Text'), {
|
|
|
|
as: 'Reviews',
|
|
|
|
foreignKey: 'bookReferenceId',
|
|
|
|
});
|
|
|
|
|
|
|
|
BookReference.hasMany(Review.scope('Rating'), {
|
|
|
|
as: 'Ratings',
|
2020-01-25 21:52:37 +01:00
|
|
|
foreignKey: 'bookReferenceId',
|
|
|
|
});
|
2020-01-14 23:26:39 +01:00
|
|
|
|
|
|
|
return BookReference;
|
|
|
|
}
|