1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-07-31 00:19:36 +02:00

Add app categories (#0)

add app categories
This commit is contained in:
François Darveau 2021-06-26 15:06:47 -04:00 committed by François Darveau
parent 6f44200a3c
commit 31cf2bc5ad
24 changed files with 1772 additions and 939 deletions

View file

@ -10,6 +10,10 @@ const App = sequelize.define('App', {
type: DataTypes.STRING,
allowNull: false
},
categoryId: {
type: DataTypes.INTEGER,
allowNull: false
},
icon: {
type: DataTypes.STRING,
allowNull: false,

View file

@ -6,6 +6,10 @@ const Category = sequelize.define('Category', {
type: DataTypes.STRING,
allowNull: false
},
type: {
type: DataTypes.STRING,
allowNull: false
},
isPinned: {
type: DataTypes.BOOLEAN,
defaultValue: false

View file

@ -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'