Commit d78af1bbe7758f8820cb3c316d0c8fe7ed357627
1 parent
32390a32
Exists in
master
and in
1 other branch
Refactoring the source code of endpoints files
Showing
1 changed file
with
4 additions
and
4 deletions
Show diff stats
endpoints/video_legenda.js
... | ... | @@ -9,25 +9,25 @@ var fs = require('fs'); |
9 | 9 | |
10 | 10 | function init(req, res) { |
11 | 11 | /* Verifica se os paramêtros [transparencia, texto] possuem algum valor */ |
12 | - if ((req.body.linguagem !== '') && (req.body.posicao !== '') && (req.body.tamanho !== '') && (req.body.transparencia !== '')) { | |
12 | + if ((req.body.linguagem === '') || (req.body.posicao === '') || (req.body.tamanho === '') || (req.body.transparencia === '')) { | |
13 | 13 | res.send(500, parameters.errorMessage('O valor de algum parâmetro está vazio')); |
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | 17 | /* Verifica se os paramêtros [linguagem, posicao, tamanho, transparencia] possuem os seus únicos valores possíveis */ |
18 | - if ((parameters.checkLanguage(req.body.linguagem) === true) && (parameters.checkPosition(req.body.posicao) === true) && (parameters.checkSize(req.body.tamanho) === true) && (parameters.checkTransparency(req.body.transparencia) === true)) { | |
18 | + if ((parameters.checkLanguage(req.body.linguagem) === false) || (parameters.checkPosition(req.body.posicao) === false) || (parameters.checkSize(req.body.tamanho) === false) || (parameters.checkTransparency(req.body.transparencia) === false)) { | |
19 | 19 | res.send(500, parameters.errorMessage('Parâmetros insuficientes ou inválidos')); |
20 | 20 | return; |
21 | 21 | } |
22 | 22 | |
23 | 23 | /* Checa se o arquivo de vídeo submetivo possui uma extensão válida */ |
24 | - if (parameters.checkVideo(req.files.video.name)) { | |
24 | + if (parameters.checkVideo(req.files.video.name) === false) { | |
25 | 25 | res.send(500, parameters.errorMessage('Vídeo com Extensão Inválida')); |
26 | 26 | return; |
27 | 27 | } |
28 | 28 | |
29 | 29 | /* Checa se o arquivo de legenda submetivo possui uma extensão válida */ |
30 | - if (parameters.checkSubtitle(req.files.legenda.name)) { | |
30 | + if (parameters.checkSubtitle(req.files.legenda.name) === false) { | |
31 | 31 | res.send(500, parameters.errorMessage('Legenda com Extensão Inválida')); |
32 | 32 | return; |
33 | 33 | } | ... | ... |