summaryrefslogtreecommitdiffstats
path: root/server/models
diff options
context:
space:
mode:
authorUdo Walter2018-08-01 22:17:33 +0200
committerUdo Walter2018-08-01 22:17:33 +0200
commitfaf1188d03e1302dd615a118bce73dd6197be8f1 (patch)
tree207d484a6d68f3d77bc49815ea92c13f4da057c3 /server/models
parent[server/idoit] iDoIT api call returns now the object itself and the childs. (diff)
downloadbas-faf1188d03e1302dd615a118bce73dd6197be8f1.tar.gz
bas-faf1188d03e1302dd615a118bce73dd6197be8f1.tar.xz
bas-faf1188d03e1302dd615a118bce73dd6197be8f1.zip
[groups] add edit functionality to group infos
Diffstat (limited to 'server/models')
-rw-r--r--server/models/client.js4
-rw-r--r--server/models/group.js7
2 files changed, 7 insertions, 4 deletions
diff --git a/server/models/client.js b/server/models/client.js
index 483d1e6..5789788 100644
--- a/server/models/client.js
+++ b/server/models/client.js
@@ -8,7 +8,7 @@ module.exports = (sequelize, DataTypes) => {
type: DataTypes.INTEGER
},
name: DataTypes.STRING,
- description: DataTypes.STRING,
+ description: DataTypes.STRING(2048),
ip: DataTypes.STRING,
mac: DataTypes.STRING,
uuid: DataTypes.STRING
@@ -17,7 +17,7 @@ module.exports = (sequelize, DataTypes) => {
})
client.associate = function (models) {
var GroupXClient = sequelize.define('group_x_client', {}, { timestamps: false, freezeTableName: true })
- client.belongsToMany(models.group, { as: 'groups', through: GroupXClient, foreignKey: 'clientId', otherKey: 'groupId'})
+ client.belongsToMany(models.group, { as: 'groups', through: GroupXClient, foreignKey: 'clientId', otherKey: 'groupId' })
}
return client
}
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
}