mirror of
https://gitlab.com/Alamantus/Readlebee.git
synced 2025-03-25 12:50:44 +01:00
- Split models & associations into their own files - Update columns and requirements - Create PermissionLevel model & add to relevant models
23 lines
No EOL
419 B
JavaScript
23 lines
No EOL
419 B
JavaScript
module.exports = models => {
|
|
const {
|
|
Recommendation,
|
|
User,
|
|
BookReference,
|
|
} = models;
|
|
|
|
Recommendation.belongsTo(User, {
|
|
foreignKey: 'fromUser',
|
|
onDelete: 'SET NULL',
|
|
});
|
|
Recommendation.belongsTo(User, {
|
|
foreignKey: 'toUser',
|
|
onDelete: 'CASCADE',
|
|
});
|
|
|
|
Recommendation.belongsTo(BookReference, {
|
|
foreignKey: 'bookId',
|
|
onDelete: 'CASCADE',
|
|
});
|
|
|
|
return Recommendation;
|
|
} |