flame/models/associateModels.js
2021-05-25 14:05:53 +02:00

13 lines
324 B
JavaScript

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