diff --git a/endpoints/sinal.js b/endpoints/sinal.js index 8f839c1..156fd53 100644 --- a/endpoints/sinal.js +++ b/endpoints/sinal.js @@ -1,21 +1,19 @@ var uuid = require('node-uuid'); var API = require('../db/api'); -function init_endpoint(req, res, Sign) { +function init_endpoint(req, res, Sign, Status) { /* Verifica se o paramêtro [name] existe ou possui algum valor */ if ((req.body.userId === '') || (req.body.userId === undefined)) { res.send(500, { 'error': 'Especifique o usuário'}); return; } - var array = ['Sucesso', 'Falhou', 'Processando'] - var sign_object = new Sign({ name: req.body.userId, uuid: uuid.v4(), created_at: new Date(), updated_at: new Date(), - status: array[Math.floor(Math.random() * array.length)] + status: Status }); API.create(sign_object, function(result) { diff --git a/public/assets/js/main.js b/public/assets/js/main.js index bdf08f5..095c6a4 100644 --- a/public/assets/js/main.js +++ b/public/assets/js/main.js @@ -61,10 +61,6 @@ var Main = function() { case 'Falhou': $(array[i]).addClass('_error'); break; - - case 'Processando': - $(array[i]).addClass('_processing'); - break; } } diff --git a/server.js b/server.js index 2eccb70..dc32d41 100644 --- a/server.js +++ b/server.js @@ -34,14 +34,15 @@ app.get('/signs', function(req, res) { res.sendfile('views/index.html'); }); -app.post('/sinal', function(req, res) { +app.post('/sign', function(req, res) { options.args = JSON.stringify(req.body); - PythonShell.run('Controller.py', options, function (err, results) { - if (err) { console.log(err); res.send(400); return; } + PythonShell.run('controller.py', options, function (err, results) { + if (err) { console.log(err); endpoint_sinal.init(req, res, Sign,"Falhou"); res.send(400); return; } // results is an array consisting of messages collected during execution - endpoint_sinal.init(req, res, Sign); + endpoint_sinal.init(req, res, Sign,"Sucesso"); res.send(200); }); + }); -- libgit2 0.21.2