mirror of
https://github.com/pawelmalak/flame.git
synced 2024-12-30 05:53:06 +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; |