mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-20 20:19:35 +02:00
parent
6f44200a3c
commit
31cf2bc5ad
24 changed files with 1772 additions and 939 deletions
|
@ -1,7 +1,17 @@
|
|||
const Category = require('./Category');
|
||||
const App = require('./App');
|
||||
const Bookmark = require('./Bookmark');
|
||||
|
||||
const associateModels = () => {
|
||||
|
||||
// Category <> App
|
||||
Category.hasMany(App, {
|
||||
as: 'apps',
|
||||
foreignKey: 'categoryId'
|
||||
});
|
||||
App.belongsTo(Category, { foreignKey: 'categoryId' });
|
||||
|
||||
// Category <> Bookmark
|
||||
Category.hasMany(Bookmark, {
|
||||
foreignKey: 'categoryId',
|
||||
as: 'bookmarks'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue