/* global __appdir */ var path = require('path') var db = require(path.join(__appdir, 'lib', 'sequelize')) // GET Requests module.exports.get = { getList: function (req, res) { db.client.findAll({ attributes: ['id', 'name'] }).then(list => { res.send(list) }) }, // 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) }) } }