mirror of
https://github.com/pawelmalak/flame.git
synced 2024-12-19 16:21:48 +03:00
13 lines
324 B
JavaScript
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; |