Commit dde00da1230ac535e5bba711c33a5f1e6917be45
1 parent
be65e744
Exists in
master
and in
1 other branch
add lodash and clean videornp endpoint
Showing
2 changed files
with
26 additions
and
24 deletions
Show diff stats
endpoints/videornp.js
| ... | ... | @@ -11,35 +11,35 @@ var async = require('async'); |
| 11 | 11 | function init(req, res, Request) { |
| 12 | 12 | res.set("Content-Type", "application/json"); |
| 13 | 13 | |
| 14 | - /* Verifica se os paramêtros [transparencia, texto] possuem algum valor */ | |
| 15 | - if (((req.body.legenda_url === '') && (req.body.video_url === '')) || ((typeof req.body.legenda_url === 'undefined') && (typeof req.body.video_url === 'undefined'))) { | |
| 14 | + /* Verifica se os paramêtros [transparencia, texto] possuem algum valor */ | |
| 15 | + if (((req.body.legenda_url === '') && (req.body.video_url === '')) || ((typeof req.body.legenda_url === 'undefined') && (typeof req.body.video_url === 'undefined'))) { | |
| 16 | 16 | res.send(500, parameters.errorMessage('O valor de algum parâmetro está vazio')); |
| 17 | 17 | return; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - /* Verifica se os paramêtros [transparencia, texto] possuem algum valor */ | |
| 21 | - if ((typeof req.body.revisaomanual === 'undefined') || ((req.body.revisaomanual.toUpperCase() !== "SIM") && (req.body.revisaomanual.toUpperCase() !== "NAO"))) { | |
| 22 | - res.send(500, parameters.errorMessage('O valor do parâmetro revisaomanual é inválido.')); | |
| 23 | - return; | |
| 24 | - } | |
| 20 | + /* Verifica se os paramêtros [transparencia, texto] possuem algum valor */ | |
| 21 | + if ((typeof req.body.revisaomanual === 'undefined') || ((req.body.revisaomanual.toUpperCase() !== "SIM") && (req.body.revisaomanual.toUpperCase() !== "NAO"))) { | |
| 22 | + res.send(500, parameters.errorMessage('O valor do parâmetro revisaomanual é inválido.')); | |
| 23 | + return; | |
| 24 | + } | |
| 25 | 25 | |
| 26 | - if ((typeof req.body.conteudista === 'undefined') || (req.body.conteudista === '')) { | |
| 27 | - res.send(500, parameters.errorMessage('O valor de algum parâmetro está vazio')); | |
| 28 | - return; | |
| 29 | - } | |
| 26 | + if ((typeof req.body.conteudista === 'undefined') || (req.body.conteudista === '')) { | |
| 27 | + res.send(500, parameters.errorMessage('O valor de algum parâmetro está vazio')); | |
| 28 | + return; | |
| 29 | + } | |
| 30 | 30 | |
| 31 | - if ((typeof req.body.instituicao === 'undefined') || (req.body.instituicao === '')) { | |
| 32 | - res.send(500, parameters.errorMessage('O valor de algum parâmetro está vazio')); | |
| 33 | - return; | |
| 34 | - } | |
| 31 | + if ((typeof req.body.instituicao === 'undefined') || (req.body.instituicao === '')) { | |
| 32 | + res.send(500, parameters.errorMessage('O valor de algum parâmetro está vazio')); | |
| 33 | + return; | |
| 34 | + } | |
| 35 | 35 | |
| 36 | - if ((typeof req.body.usuario === 'undefined') || (req.body.usuario === '')) { | |
| 37 | - res.send(500, parameters.errorMessage('O valor de algum parâmetro está vazio')); | |
| 38 | - return; | |
| 39 | - } | |
| 36 | + if ((typeof req.body.usuario === 'undefined') || (req.body.usuario === '')) { | |
| 37 | + res.send(500, parameters.errorMessage('O valor de algum parâmetro está vazio')); | |
| 38 | + return; | |
| 39 | + } | |
| 40 | 40 | |
| 41 | 41 | process(req, res, Request); |
| 42 | -}; | |
| 42 | +} | |
| 43 | 43 | |
| 44 | 44 | function process(req, res, Request) { |
| 45 | 45 | var id = uuid.v4(); |
| ... | ... | @@ -69,7 +69,7 @@ function process(req, res, Request) { |
| 69 | 69 | res.send(500, { 'error': 'Erro na criação da requisição.'}); |
| 70 | 70 | } |
| 71 | 71 | }); |
| 72 | - | |
| 72 | + | |
| 73 | 73 | async.series([ |
| 74 | 74 | // Cria a pasta apropriada |
| 75 | 75 | function(callback) { |
| ... | ... | @@ -140,7 +140,7 @@ function callCore(id, video, subtitle, req, res, Request, request_object) { |
| 140 | 140 | |
| 141 | 141 | console.log("ID: " + request_object.id); |
| 142 | 142 | core.call(id, command_line, req, res, Request, request_object); |
| 143 | -}; | |
| 143 | +} | |
| 144 | 144 | |
| 145 | 145 | function callCoreSubtitle(id, subtitle, req, res, Request, request_object) { |
| 146 | 146 | /* Move a legenda submetido para a pasta com o seu ID correspondente */ |
| ... | ... | @@ -168,6 +168,6 @@ function callCoreSubtitle(id, subtitle, req, res, Request, request_object) { |
| 168 | 168 | res.send(500, parameters.errorMessage('Erro na chamada ao core')); |
| 169 | 169 | }); |
| 170 | 170 | |
| 171 | -}; | |
| 171 | +} | |
| 172 | 172 | |
| 173 | 173 | module.exports.init = init; | ... | ... |