reduccion de lineas de codigo

This commit is contained in:
Lemuel Marquez
2021-01-14 03:13:37 -06:00
parent 5de85194fe
commit 0de481b596
32 changed files with 182 additions and 1553 deletions
+2 -6
View File
@@ -1,17 +1,14 @@
const drive = require('../../helper/drive');
const validar = require('../../helper/validar');
const Servicio = require('../../db/tablas/Servicio');
const Usuario = require('../../db/tablas/Usuario');
const update = async (body, files) => {
let idServicio = validar.validarId(body.idServicio);
let dataUpdate = {};
console.log('hola2');
const idServicio = validar.validarId(body.idServicio);
const dataUpdate = {};
return Servicio.findOne({ where: { idServicio } })
.then(async (res) => {
if (!res) throw new Error('Este Servicio Social no existe en la db.');
try {
if (files['cartaAceptacion'][0].filename)
dataUpdate.cartaAceptacion = await drive.uploadFile(
@@ -54,7 +51,6 @@ const update = async (body, files) => {
);
if (body.telefono)
dataUpdate.telefono = validar.validarNumero(body.telefono, 15);
if (validar.isObjectEmpty(dataUpdate))
throw new Error(
'No se envio nada para actualizar este Servicio Social'