From 6d7ca39adac324246b6862ed1299384ef998b8ec Mon Sep 17 00:00:00 2001 From: Udo Walter Date: Thu, 2 Aug 2018 04:38:41 +0000 Subject: [groups] add delete client/group functionality --- server/api/clients.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'server/api/clients.js') diff --git a/server/api/clients.js b/server/api/clients.js index 2780bd6..ef0dcaa 100644 --- a/server/api/clients.js +++ b/server/api/clients.js @@ -35,7 +35,7 @@ module.exports.get = { // POST Requests module.exports.post = { // create client or update information of a client (returns id) - updateOrCreate: function (req, res) { + save: function (req, res) { const id = req.body.id > 0 ? req.body.id : null if (id) { db.client.findOne({ where: { id: id } }).then(client => { @@ -49,5 +49,10 @@ module.exports.post = { if (req.body.groupIds) client.setGroups(req.body.groupIds).then(() => { res.send({ id: client.id }) }) }) } + }, + + // delete clients + delete: function (req, res) { + db.client.destroy({ where: { id: req.body.ids } }).then(() => { res.end() }) } } -- cgit v1.2.3-55-g7522