summaryrefslogtreecommitdiffstats
path: root/server/models/group.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/group.js')
-rw-r--r--server/models/group.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/server/models/group.js b/server/models/group.js
index e988497..62a5665 100644
--- a/server/models/group.js
+++ b/server/models/group.js
@@ -8,13 +8,16 @@ module.exports = (sequelize, DataTypes) => {
type: DataTypes.INTEGER
},
name: DataTypes.STRING,
- description: DataTypes.STRING
+ description: DataTypes.STRING(2048)
}, {
timestamps: false
})
group.associate = function (models) {
var GroupXGroup = sequelize.define('group_x_group', {}, { timestamps: false, freezeTableName: true })
- group.belongsToMany(group, { as: 'parents', through: GroupXGroup, foreignKey: 'childId', otherKey: 'parentId'})
+ var GroupXClient = sequelize.define('group_x_client', {}, { timestamps: false, freezeTableName: true })
+ group.belongsToMany(group, { as: 'parents', through: GroupXGroup, foreignKey: 'childId', otherKey: 'parentId' })
+ group.belongsToMany(group, { as: 'subgroups', through: GroupXGroup, foreignKey: 'parentId', otherKey: 'childId' })
+ group.belongsToMany(models.client, { as: 'clients', through: GroupXClient, foreignKey: 'groupId', otherKey: 'clientId' })
}
return group
}