mirror of
https://gitlab.com/Alamantus/Readlebee.git
synced 2025-03-25 04:40:43 +01:00
29 lines
No EOL
473 B
JavaScript
29 lines
No EOL
473 B
JavaScript
module.exports = models => {
|
|
const {
|
|
Shelf,
|
|
User,
|
|
ShelfItem,
|
|
PermissionLevel,
|
|
} = models;
|
|
|
|
Shelf.belongsTo(User, {
|
|
foreignKey: 'userId',
|
|
onDelete: 'CASCADE',
|
|
});
|
|
|
|
Shelf.belongsTo(PermissionLevel, {
|
|
foreignKey: 'permissionLevel',
|
|
onDelete: 'SET NULL',
|
|
});
|
|
|
|
Shelf.belongsTo(User, {
|
|
foreignKey: 'permissionLevel',
|
|
onDelete: 'CASCADE',
|
|
});
|
|
|
|
Shelf.hasMany(ShelfItem, {
|
|
foreignKey: 'shelfId',
|
|
});
|
|
|
|
return Shelf;
|
|
} |