summaryrefslogtreecommitdiffstats
path: root/server/api/backends.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/api/backends.js')
-rw-r--r--server/api/backends.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/server/api/backends.js b/server/api/backends.js
index fd2657b..b744bd2 100644
--- a/server/api/backends.js
+++ b/server/api/backends.js
@@ -11,7 +11,6 @@ module.exports = {
if (instance === null) {
res.status(500).send({ auth: false, status: 'TYPE_INVALID', error_message: 'The provided backend type is invalid.' })
}
-
res.status(200).send(instance.getCredentials())
},
@@ -48,6 +47,21 @@ module.exports = {
})
},
+ checkConnection: function (req, res) {
+ var x = Math.floor(Math.random() * Math.floor(2))
+ var y = ''
+ if (x === 0) {
+ y = 'success'
+ } else {
+ y = 'error'
+ }
+ var w = 'Oh noes! An error occurred.'
+ var z = Math.floor(Math.random() * Math.floor(5000))
+
+
+ setTimeout(function() { res.status(200).send({ status: y, msg: w }) }, 0)
+ },
+
// POST REQUESTS
saveBackend: function (req, res) {
// Save credentials in the db.
@@ -66,10 +80,10 @@ module.exports = {
res.status(200).send('success')
},
- deleteBackendById: function (req, res) {
- const backendId = req.body.id
+ deleteBackends: function (req, res) {
+ const backendIds = req.body.id
- db.backend.destroy({ where: { id: backendId } }).then(function () {
+ db.backend.destroy({ where: { id: backendIds } }).then(function () {
res.status(200).send('success')
})
}