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
Category.hasMany(Bookmark, {
as: 'bookmarks',
foreignKey: 'categoryId'
});
2021-05-25 15:05:53 +03:00
Bookmark.belongsTo(Category, { foreignKey: 'categoryId' });
2021-05-22 20:04:34 +03:00
}
module.exports = associateModels;