listo
This commit is contained in:
@@ -9,6 +9,7 @@ const cancelar = async (body) => {
|
||||
let idServicio = validar.validarId(body.idServicio);
|
||||
let mensaje = validar.validarAlfanumerico(body.mensaje, 'El mensaje', 800);
|
||||
let correoResponsable = {};
|
||||
let correoAlumno = {};
|
||||
let emailResponsable = '';
|
||||
let idUsuario;
|
||||
|
||||
@@ -27,10 +28,8 @@ const cancelar = async (body) => {
|
||||
throw new Error(
|
||||
'Este Servicio Social ya fue finalizado, no se puede cancelar.'
|
||||
);
|
||||
|
||||
let correoAlumno = correos.canceladoAlumno(mensaje, res.Usuario.nombre);
|
||||
|
||||
idUsuario = res.idUsuario;
|
||||
correoAlumno = correos.canceladoAlumno(mensaje, res.Usuario.nombre);
|
||||
correoResponsable = correos.canceladoResponsable(
|
||||
mensaje,
|
||||
res.Usuario.nombre
|
||||
@@ -38,22 +37,16 @@ const cancelar = async (body) => {
|
||||
emailResponsable = res.Programa.Usuario.usuario;
|
||||
return gmail(correoAlumno.subject, res.correo, correoAlumno.msj);
|
||||
})
|
||||
.then((res) => {
|
||||
return gmail(
|
||||
correoResponsable.subject,
|
||||
emailResponsable,
|
||||
correoResponsable.msj
|
||||
);
|
||||
})
|
||||
.then((res) => {
|
||||
return Usuario.update(
|
||||
.then((res) =>
|
||||
gmail(correoResponsable.subject, emailResponsable, correoResponsable.msj)
|
||||
)
|
||||
.then((res) =>
|
||||
Usuario.update(
|
||||
{ activo: false, password: null },
|
||||
{ where: { idUsuario } }
|
||||
);
|
||||
})
|
||||
.then((res) => {
|
||||
return Servicio.update({ idStatus: 10 }, { where: { idServicio } });
|
||||
})
|
||||
)
|
||||
)
|
||||
.then((res) => Servicio.update({ idStatus: 10 }, { where: { idServicio } }))
|
||||
.then((res) => {
|
||||
return { message: 'Se cancelo correctamente este Servicio Social.' };
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user