flame/models/associateModels.js

13 lines
324 B
JavaScript
Raw Normal View History

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