flame/models/associateModels.js

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