This commit is contained in:
Lemuel Marquez
2021-01-13 12:00:11 -06:00
parent ff6699ff20
commit 5de85194fe
8 changed files with 53 additions and 75 deletions
+9 -12
View File
@@ -7,6 +7,8 @@ const Programa = require('../../db/tablas/Programa');
const liberacion = async (body) => {
let idServicio = validar.validarId(body.idServicio);
let correo = {};
let update = { idStatus: 6 };
return Servicio.findOne({
where: { idServicio },
@@ -14,14 +16,14 @@ const liberacion = async (body) => {
})
.then(async (res) => {
if (!res) throw new Error('No existe este Servicio Social.');
if (res.Programa.acatlan && !body.vistoBuenoAcatlan)
throw new Error(
'El programa de este Servicio Solcial es Acatlán Contigo y no se envio la variable validando este servicio.'
);
// if (res.Programa.acatlan && !body.vistoBuenoAcatlan)
// throw new Error(
// 'El programa de este Servicio Social es Acatlán Contigo y no se envio la variable validando este servicio.'
// );
switch (res.idStatus) {
case 5:
let correo = correos.terminoValidado(res.Usuario.nombre);
correo = correos.terminoValidado(res.Usuario.nombre);
if (body.vistoBuenoAcatlan) update.vistoBuenoAcatlan = true;
return gmail(correo.subject, res.correo, correo.msj);
case 1:
case 2:
@@ -44,12 +46,7 @@ const liberacion = async (body) => {
throw new Error('Este Servicio Social esta cancelado.');
}
})
.then((res) => {
let update = { idStatus: 6 };
if (body.vistoBuenoAcatlan) update.vistoBuenoAcatlan = true;
return Servicio.update(update, { where: { idServicio } });
})
.then((res) => Servicio.update(update, { where: { idServicio } }))
.then((res) => {
return {
message: