reduccion de lineas de codigo
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user