mirror of
https://github.com/pawelmalak/flame.git
synced 2024-12-24 02:32:28 +03:00
13 lines
324 B
JavaScript
13 lines
324 B
JavaScript
|
const Category = require('./Category');
|
||
|
const Bookmark = require('./Bookmark');
|
||
|
|
||
|
const associateModels = () => {
|
||
|
// Category <> Bookmark
|
||
|
Bookmark.belongsTo(Category, { foreignKey: 'categoryId' });
|
||
|
Category.hasMany(Bookmark, {
|
||
|
as: 'bookmarks',
|
||
|
foreignKey: 'categoryId'
|
||
|
});
|
||
|
}
|
||
|
|
||
|
module.exports = associateModels;
|