liberacion
This commit is contained in:
@@ -10,6 +10,9 @@ const registroValidado = async (body) => {
|
||||
let fechaNacimiento = validar.validarFecha(body.fechaNacimiento);
|
||||
let telefono = validar.validarNumero(body.telefono, 10);
|
||||
let direccion = validar.validar(body.direccion, 'La dirección', 200);
|
||||
let correoAlumno = {};
|
||||
let correoResponsable = {};
|
||||
let emailResponsable = '';
|
||||
|
||||
return Servicio.findOne({
|
||||
where: { idServicio },
|
||||
@@ -18,27 +21,17 @@ const registroValidado = async (body) => {
|
||||
{ model: Programa, include: [{ model: Usuario }] },
|
||||
],
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (!res) throw new Error('No existe este servicio.');
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('No existe este Servicio Social.');
|
||||
|
||||
switch (res.idStatus) {
|
||||
case 2:
|
||||
let correoAlumno = correos.registroValidadoAlumno(res.Usuario.nombre);
|
||||
let correoResponsable = correos.registroValidadoResponsable(
|
||||
correoAlumno = correos.registroValidadoAlumno(res.Usuario.nombre);
|
||||
correoResponsable = correos.registroValidadoResponsable(
|
||||
res.Usuario.nombre
|
||||
);
|
||||
|
||||
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 } }
|
||||
);
|
||||
emailResponsable = res.Programa.Usuario.usuario;
|
||||
return gmail(correoAlumno.subject, res.correo, correoAlumno.msj);
|
||||
case 1:
|
||||
throw new Error(
|
||||
'Este Servicio Social aun no puede pasar a Registro Validado.'
|
||||
@@ -65,6 +58,19 @@ const registroValidado = async (body) => {
|
||||
);
|
||||
}
|
||||
})
|
||||
.then((res) => {
|
||||
return gmail(
|
||||
correoResponsable.subject,
|
||||
emailResponsable,
|
||||
correoResponsable.msj
|
||||
);
|
||||
})
|
||||
.then((res) => {
|
||||
return Servicio.update(
|
||||
{ idStatus: 3, direccion, telefono, fechaNacimiento },
|
||||
{ where: { idServicio } }
|
||||
);
|
||||
})
|
||||
.then((res) => {
|
||||
return {
|
||||
message:
|
||||
|
||||
Reference in New Issue
Block a user