flame/models/associateModels.js

15 lines
No EOL
305 B
JavaScript

const Category = require('./Category');
const Bookmark = require('./Bookmark');
const associateModels = () => {
Category.hasMany(Bookmark, {
foreignKey: 'categoryId',
as: 'bookmarks'
});
Bookmark.belongsTo(Category, {
foreignKey: 'categoryId'
});
}
module.exports = associateModels;