subri carta de termino e informe global listo

This commit is contained in:
2020-11-23 00:52:38 -06:00
parent 2ae79c3962
commit 7973212dbb
10 changed files with 247 additions and 44 deletions
+41 -26
View File
@@ -20,35 +20,50 @@ const registroValidado = async (body) => {
})
.then(async (res) => {
if (!res) throw new Error('No existe este servicio.');
if (res.idStatus === 3)
throw new Error('Este servicio ya se encuentra en Registro Validado.');
else if (res.idStatus >= 7)
throw new Error(
'Este servicio se encuentra cancelado o rechazado. Comunicate con COESI para solucionar tu problema.'
);
else if (res.idStatus > 2)
throw new Error('Este servicio ya paso por el Registro Validado.');
else if (res.idStatus === 1)
throw new Error(
'Este servicio aun no puede pasar a Registro Validado.'
);
let correoAlumno = correos.registroValidadoAlumno(res.Usuario.nombre);
let correoResponsable = correos.registroValidadoResponsable(
res.Usuario.nombre
);
switch (res.idStatus) {
case 2:
let correoAlumno = correos.registroValidadoAlumno(res.Usuario.nombre);
let correoResponsable = correos.registroValidadoResponsable(
res.Usuario.nombre
);
await gmail(correoAlumno.subject, res.correo, correoAlumno.msj);
await gmail(
correoResponsable.subject,
res.Programa.Usuario.usuario,
correoResponsable.msj
);
await gmail(correoAlumno.subject, res.correo, correoAlumno.msj);
await gmail(
correoResponsable.subject,
res.Programa.Usuario.usuario,
correoResponsable.msj
);
return Servicio.update(
{ idStatus: 3, direccion, telefono, fechaNacimiento },
{ where: { idServicio } }
);
return Servicio.update(
{ idStatus: 3, direccion, telefono, fechaNacimiento },
{ where: { idServicio } }
);
case 1:
throw new Error(
'Este Servicio Social aun no puede pasar a Registro Validado.'
);
case 3:
throw new Error(
'Este servicio ya se encuentra en Registro Validado.'
);
case 4:
case 5:
case 6:
throw new Error(
'Este Servicio Social ya paso por el Registro Validado.'
);
case 7:
case 8:
case 9:
throw new Error(
'Este Servicio Social se encuentra rechazado. Comunicate con COESI para solucionar tu problema.'
);
case 10:
throw new Error(
'Este Servicio Social esta cancelado. Comunicate con COESI para solucionar tu problema.'
);
}
})
.then((res) => {
return {