This commit is contained in:
Lemuel Marquez
2021-01-12 21:09:37 -06:00
parent 2a0f649f59
commit fc77a4d755
16 changed files with 1334 additions and 125 deletions
+5 -15
View File
@@ -4,6 +4,7 @@ const Servicio = require('../../db/tablas/Servicio');
const informeGlobal = async (body, file) => {
let idServicio = validar.validarId(body.idServicio);
let path = `./server/uploads/${validar.validar(file, 'El archivo', 1000)}`;
return Servicio.findOne({
where: { idServicio },
@@ -14,12 +15,6 @@ const informeGlobal = async (body, file) => {
switch (res.idStatus) {
case 4:
case 9:
let path = `./server/uploads/${validar.validar(
file,
'El archivo',
1000
)}`;
return drive.uploadFile(
path,
`Informe_Global.pdf`,
@@ -49,15 +44,10 @@ const informeGlobal = async (body, file) => {
);
}
})
.then((res) => {
return Servicio.update(
{ informeGlobal: res },
{ where: { idServicio } }
);
})
.then(async (res) => {
return validar.validarPreTermino(idServicio);
})
.then((res) =>
Servicio.update({ informeGlobal: res }, { where: { idServicio } })
)
.then(async (res) => validar.validarPreTermino(idServicio))
.then((res) => {
return { message: `Se subio el Informe Global correctamente. ${res}` };
});