Commit 407b4f44586261d5539a8a8963e79d7a0e08934f

Authored by dhuy
1 parent d78af1bb
Exists in master and in 1 other branch devel

Refactoring the source code of endpoints files

Showing 1 changed file with 3 additions and 3 deletions   Show diff stats
endpoints/video.js
... ... @@ -9,19 +9,19 @@ var fs = require('fs');
9 9  
10 10 function init(req, res) {
11 11 /* Verifica se os paramêtros [posicao, tamanho, transparencia] possuem algum valor */
12   - if ((req.body.posicao !== '') && (req.body.tamanho !== '') && (req.body.transparencia !== '')) {
  12 + if ((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.checkPosition(req.body.posicao) === true) && (parameters.checkSize(req.body.tamanho) === true) && (parameters.checkTransparency(req.body.transparencia) === true)) {
  18 + if ((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 }
... ...