summaryrefslogtreecommitdiffstats
path: root/server/api/clients.js
blob: d494fd008fe03d6ccf7e64a99474173917f062b9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* 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)
    })
  },

  getGroups: function (req, res) {
    db.client.findOne({ where: { id: req.query.id } }).then(client => {
      client.getGroups().then(groups => {
        res.send(groups)
      })
    })
  }
}