summaryrefslogtreecommitdiffstats
path: root/server/api/clients.js
diff options
context:
space:
mode:
authorUdo Walter2018-08-02 06:38:41 +0200
committerUdo Walter2018-08-02 06:38:41 +0200
commit6d7ca39adac324246b6862ed1299384ef998b8ec (patch)
tree82de9db2ece4396a9fdf4d98d9e55b5c32c2391c /server/api/clients.js
parent[groups] add ability to show all groups and clients (diff)
downloadbas-6d7ca39adac324246b6862ed1299384ef998b8ec.tar.gz
bas-6d7ca39adac324246b6862ed1299384ef998b8ec.tar.xz
bas-6d7ca39adac324246b6862ed1299384ef998b8ec.zip
[groups] add delete client/group functionality
Diffstat (limited to 'server/api/clients.js')
-rw-r--r--server/api/clients.js7
1 files changed, 6 insertions, 1 deletions
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() })
}
}