summaryrefslogtreecommitdiffstats
path: root/server/api/clients.js
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/api/clients.js
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/api/clients.js')
-rw-r--r--server/api/clients.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/server/api/clients.js b/server/api/clients.js
index d494fd0..8daab55 100644
--- a/server/api/clients.js
+++ b/server/api/clients.js
@@ -10,11 +10,17 @@ module.exports.get = {
})
},
- getGroups: function (req, res) {
- db.client.findOne({ where: { id: req.query.id } }).then(client => {
- client.getGroups().then(groups => {
- res.send(groups)
- })
+ // get all clients that have no groups
+ getTopLevel: function (req, res) {
+ db.client.findAll({ where: { '$groups.id$': null }, include: ['groups'] }).then(clients => {
+ res.send(clients)
+ })
+ },
+
+ // get name, description, ip, mac and uuid of a client (by id)
+ getClient: function (req, res) {
+ db.client.findOne({ where: { id: req.query.id }, include: ['groups'] }).then(client => {
+ res.send(client)
})
}
}