1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-07-19 19:49:37 +02:00
flame/models/associateModels.js

13 lines
324 B
JavaScript
Raw Normal View History

2021-05-22 19:04:34 +02:00
const Category = require('./Category');
const Bookmark = require('./Bookmark');
const associateModels = () => {
// Category <> Bookmark
Category.hasMany(Bookmark, {
as: 'bookmarks',
foreignKey: 'categoryId'
});
2021-05-25 14:05:53 +02:00
Bookmark.belongsTo(Category, { foreignKey: 'categoryId' });
2021-05-22 19:04:34 +02:00
}
module.exports = associateModels;