rechazar carta aceptación, termino e informe global
This commit is contained in:
@@ -101,7 +101,7 @@ const nuevo = async (body) => {
|
||||
'Este Servicio Social se encuentra rechazado. No se puede avanzar hasta que se corriga lo necesario.'
|
||||
);
|
||||
case 10:
|
||||
throw new Error('Este Servicio Social esta cancelado.');
|
||||
throw new Error('Este Servicio Social fue cancelado.');
|
||||
}
|
||||
})
|
||||
.then((res) => {
|
||||
@@ -111,7 +111,7 @@ const nuevo = async (body) => {
|
||||
);
|
||||
})
|
||||
.then((res) => {
|
||||
return { message: 'Se guardo tus respuestas correctamente.' };
|
||||
return { message: 'Se guardaron tus respuestas correctamente.' };
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -39,10 +39,11 @@ const nuevo = async (body) => {
|
||||
'Aun no se puede contestar el cuestionario este Servicio Social.'
|
||||
);
|
||||
case 5:
|
||||
case 6:
|
||||
throw new Error(
|
||||
'Este Servicio Social ya paso la fase de contestar el cuestionario.'
|
||||
);
|
||||
case 6:
|
||||
throw new Error('Este Servicio Social ya finalizó.');
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
@@ -50,7 +51,7 @@ const nuevo = async (body) => {
|
||||
'Este Servicio Social se encuentra rechazado. No se puede avanzar hasta que se corriga lo necesario.'
|
||||
);
|
||||
case 10:
|
||||
throw new Error('Este Servicio Social esta cancelado.');
|
||||
throw new Error('Este Servicio Social fue cancelado.');
|
||||
}
|
||||
})
|
||||
.then((res) => {
|
||||
@@ -60,7 +61,7 @@ const nuevo = async (body) => {
|
||||
);
|
||||
})
|
||||
.then((res) => {
|
||||
return { message: 'Se guardo tus respuestas correctamente.' };
|
||||
return { message: 'Se guradaron tus respuestas correctamente.' };
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ const cancelar = async (body) => {
|
||||
include: [{ model: Programa, include: [{ model: Usuario }] }],
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('No existe este servicio.');
|
||||
if (!res) throw new Error('No existe este Servicio Social.');
|
||||
if (res.idStatus === 10)
|
||||
throw new Error('Este Servicio Social ya fue cancelado.');
|
||||
if (res.idStatus === 6)
|
||||
|
||||
@@ -10,7 +10,7 @@ const cartaTermino = async (body, file) => {
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('Este servicio no existe.');
|
||||
if (res.cartaTermino) throw new Error('Ya se subio la carta de termino.');
|
||||
if (res.cartaTermino) throw new Error('Ya se subio la Carta de Termino.');
|
||||
switch (res.idStatus) {
|
||||
case 4:
|
||||
case 8:
|
||||
@@ -28,20 +28,21 @@ const cartaTermino = async (body, file) => {
|
||||
case 2:
|
||||
case 3:
|
||||
throw new Error(
|
||||
'Aun no se puede subir la carta de termino a este Servicio Social.'
|
||||
'Aun no se puede subir la Carta de Termino a este Servicio Social.'
|
||||
);
|
||||
case 5:
|
||||
case 6:
|
||||
throw new Error(
|
||||
'Este Servicio Social ya paso la fase de subir la carta de termino.'
|
||||
'Este Servicio Social ya paso la fase de subir la Carta de Termino.'
|
||||
);
|
||||
case 6:
|
||||
throw new Error('Este Servicio Social ya finalizó.');
|
||||
case 7:
|
||||
case 9:
|
||||
throw new Error(
|
||||
'Este Servicio Social se encuentra rechazado. No se puede avanzar hasta que se corriga lo necesario.'
|
||||
);
|
||||
case 10:
|
||||
throw new Error('Este Servicio Social esta cancelado.');
|
||||
throw new Error('Este Servicio Social esta cancelado. Comunicate con COESI para solucionar tu problema.');
|
||||
}
|
||||
})
|
||||
.then((res) => {
|
||||
@@ -51,7 +52,7 @@ const cartaTermino = async (body, file) => {
|
||||
return validar.validarPreTermino(idServicio);
|
||||
})
|
||||
.then((res) => {
|
||||
return { message: `Se subio el informe global correctamente. ${res}` };
|
||||
return { message: `Se subio la Carta de Termino correctamente. ${res}` };
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ const informeGlobal = async (body, file) => {
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('Este servicio no existe.');
|
||||
if (res.informeGlobal) throw new Error('Ya se subio el informe global.');
|
||||
if (res.informeGlobal) throw new Error('Ya se subio el Informe Global.');
|
||||
switch (res.idStatus) {
|
||||
case 4:
|
||||
case 9:
|
||||
@@ -30,20 +30,21 @@ const informeGlobal = async (body, file) => {
|
||||
case 2:
|
||||
case 3:
|
||||
throw new Error(
|
||||
'Aun no se puede subir el informe global a este Servicio Social.'
|
||||
'Aun no se puede subir el Informe Global a este Servicio Social.'
|
||||
);
|
||||
case 5:
|
||||
case 6:
|
||||
throw new Error(
|
||||
'Este Servicio Social ya paso la fase de subir el informe global.'
|
||||
'Este Servicio Social ya paso la fase de subir el Informe Global.'
|
||||
);
|
||||
case 6:
|
||||
throw new Error('Este Servicio Social ya finalizó.');
|
||||
case 7:
|
||||
case 8:
|
||||
throw new Error(
|
||||
'Este Servicio Social se encuentra rechazado. No se puede avanzar hasta que se corriga lo necesario.'
|
||||
);
|
||||
case 10:
|
||||
throw new Error('Este Servicio Social esta cancelado.');
|
||||
throw new Error('Este Servicio Social esta cancelado. Comunicate con COESI para solucionar tu problema.');
|
||||
}
|
||||
})
|
||||
.then((res) => {
|
||||
@@ -53,7 +54,7 @@ const informeGlobal = async (body, file) => {
|
||||
return validar.validarPreTermino(idServicio);
|
||||
})
|
||||
.then((res) => {
|
||||
return { message: `Se subio el informe global correctamente. ${res}` };
|
||||
return { message: `Se subio el Informe Global correctamente. ${res}` };
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
const validar = require('../../helper/validar');
|
||||
const gmail = require('../../helper/gmail');
|
||||
const correos = require('../../helper/correos');
|
||||
const Servicio = require('../../db/tablas/Servicio');
|
||||
const Usuario = require('../../db/tablas/Usuario');
|
||||
const Programa = require('../../db/tablas/Programa');
|
||||
|
||||
const cancelar = async (body) => {
|
||||
let idServicio = validar.validarId(body.idServicio);
|
||||
let mensaje = validar.validarAlfanumerico(body.mensaje, 'El mensaje', 800);
|
||||
let correoResponsable = {};
|
||||
let emailResponsable = '';
|
||||
|
||||
return Servicio.findOne({
|
||||
where: { idServicio },
|
||||
include: [{ model: Programa, include: [{ model: Usuario }] }],
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('No existe este Servicio Social.');
|
||||
|
||||
switch (res.idStatus) {
|
||||
case 1:
|
||||
let correoAlumno = correos.preRegistroRechazadoAlumno(
|
||||
mensaje,
|
||||
res.Usuario.nombre
|
||||
);
|
||||
|
||||
correoResponsable = correos.preRegistroRechazadoResponsable(
|
||||
mensaje,
|
||||
res.Usuario.nombre
|
||||
);
|
||||
emailResponsable = res.Programa.Usuario.usuario;
|
||||
return gmail(correoAlumno.subject, res.correo, correoAlumno.msj);
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 8:
|
||||
case 9:
|
||||
throw new Error(
|
||||
'No se puede rechazar la Carta de Aceptación en este punto del Servicio Social.'
|
||||
);
|
||||
case 6:
|
||||
throw new Error('Este Servicio Social ya finalizó.');
|
||||
case 7:
|
||||
throw new Error(
|
||||
'Este Servicio Social ya tiene la Carta de Aceptación rechazada.'
|
||||
);
|
||||
case 10:
|
||||
throw new Error('Este Servicio Social fue cancelado.');
|
||||
}
|
||||
})
|
||||
.then((res) => {
|
||||
return gmail(
|
||||
correoResponsable.subject,
|
||||
emailResponsable,
|
||||
correoResponsable.msj
|
||||
);
|
||||
})
|
||||
.then((res) => {
|
||||
return Servicio.update({ idStatus: 7 }, { where: { idServicio } });
|
||||
})
|
||||
.then((res) => {
|
||||
return { message: 'Se rechazo correctamente la Carta de Aceptación.' };
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = cancelar;
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
const validar = require('../../helper/validar');
|
||||
const gmail = require('../../helper/gmail');
|
||||
const correos = require('../../helper/correos');
|
||||
const Servicio = require('../../db/tablas/Servicio');
|
||||
const Usuario = require('../../db/tablas/Usuario');
|
||||
const Programa = require('../../db/tablas/Programa');
|
||||
|
||||
const cancelar = async (body) => {
|
||||
let idServicio = validar.validarId(body.idServicio);
|
||||
let mensaje = validar.validarAlfanumerico(body.mensaje, 'El mensaje', 800);
|
||||
let correoResponsable = {};
|
||||
let emailResponsable = '';
|
||||
|
||||
return Servicio.findOne({
|
||||
where: { idServicio },
|
||||
include: [{ model: Programa, include: [{ model: Usuario }] }],
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('No existe este Servicio Social.');
|
||||
switch (res.idStatus) {
|
||||
case 5:
|
||||
let correoAlumno = correos.terminoRechazadoAlumno(
|
||||
mensaje,
|
||||
res.Usuario.nombre
|
||||
);
|
||||
|
||||
correoResponsable = correos.terminoRechazadoResponsable(
|
||||
mensaje,
|
||||
res.Usuario.nombre
|
||||
);
|
||||
emailResponsable = res.Programa.Usuario.usuario;
|
||||
return gmail(correoAlumno.subject, res.correo, correoAlumno.msj);
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
throw new Error('Aun no se puede rechazar el Informe Global.');
|
||||
case 6:
|
||||
throw new Error('Este Servicio Social ya finalizó.');
|
||||
case 7:
|
||||
case 8:
|
||||
throw new Error(
|
||||
'No se puede rechazar el Informe Global en este punto del Servicio Social.'
|
||||
);
|
||||
case 9:
|
||||
throw new Error(
|
||||
'Este Servicio Social ya tiene el Informe Global rechazado.'
|
||||
);
|
||||
case 10:
|
||||
throw new Error('Este Servicio Social fue cancelado.');
|
||||
}
|
||||
})
|
||||
.then((res) => {
|
||||
return gmail(
|
||||
correoResponsable.subject,
|
||||
emailResponsable,
|
||||
correoResponsable.msj
|
||||
);
|
||||
})
|
||||
.then((res) => {
|
||||
return Servicio.update({ idStatus: 9 }, { where: { idServicio } });
|
||||
})
|
||||
.then((res) => {
|
||||
return { message: 'Se rechazo correctamente el Informe Global.' };
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = cancelar;
|
||||
@@ -0,0 +1,68 @@
|
||||
const validar = require('../../helper/validar');
|
||||
const gmail = require('../../helper/gmail');
|
||||
const correos = require('../../helper/correos');
|
||||
const Servicio = require('../../db/tablas/Servicio');
|
||||
const Usuario = require('../../db/tablas/Usuario');
|
||||
const Programa = require('../../db/tablas/Programa');
|
||||
|
||||
const cancelar = async (body) => {
|
||||
let idServicio = validar.validarId(body.idServicio);
|
||||
let mensaje = validar.validarAlfanumerico(body.mensaje, 'El mensaje', 800);
|
||||
let correoResponsable = {};
|
||||
let emailResponsable = '';
|
||||
|
||||
return Servicio.findOne({
|
||||
where: { idServicio },
|
||||
include: [{ model: Programa, include: [{ model: Usuario }] }],
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('No existe este Servicio Social.');
|
||||
switch (res.idStatus) {
|
||||
case 5:
|
||||
let correoAlumno = correos.terminoRechazadoAlumno(
|
||||
mensaje,
|
||||
res.Usuario.nombre
|
||||
);
|
||||
|
||||
correoResponsable = correos.terminoRechazadoResponsable(
|
||||
mensaje,
|
||||
res.Usuario.nombre
|
||||
);
|
||||
emailResponsable = res.Programa.Usuario.usuario;
|
||||
return gmail(correoAlumno.subject, res.correo, correoAlumno.msj);
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
throw new Error('Aun no se puede rechazar la Carta de Termino.');
|
||||
case 6:
|
||||
throw new Error('Este Servicio Social ya finalizó.');
|
||||
case 7:
|
||||
case 9:
|
||||
throw new Error(
|
||||
'No se puede rechazar la Carta de Termino en este punto del Servicio Social.'
|
||||
);
|
||||
case 8:
|
||||
throw new Error(
|
||||
'Este Servicio Social ya tiene la Carta de Termino rechazado.'
|
||||
);
|
||||
case 10:
|
||||
throw new Error('Este Servicio Social fue cancelado.');
|
||||
}
|
||||
})
|
||||
.then((res) => {
|
||||
return gmail(
|
||||
correoResponsable.subject,
|
||||
emailResponsable,
|
||||
correoResponsable.msj
|
||||
);
|
||||
})
|
||||
.then((res) => {
|
||||
return Servicio.update({ idStatus: 8 }, { where: { idServicio } });
|
||||
})
|
||||
.then((res) => {
|
||||
return { message: 'Se rechazo correctamente la Carta de Termino.' };
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = cancelar;
|
||||
|
||||
@@ -29,8 +29,9 @@ const registro = async (body) => {
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
throw new Error('Este Servicio Social ya paso por el Registro.');
|
||||
case 6:
|
||||
throw new Error('Este Servicio Social ya finalizó.');
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
@@ -38,7 +39,7 @@ const registro = async (body) => {
|
||||
'Este Servicio Social se encuentra rechazado. No se puede aceptar hasta que se corriga lo necesario.'
|
||||
);
|
||||
case 10:
|
||||
throw new Error('Este Servicio Social esta cancelado.');
|
||||
throw new Error('Este Servicio Social fue cancelado.');
|
||||
}
|
||||
})
|
||||
.then((res) => {
|
||||
|
||||
@@ -46,10 +46,11 @@ const registroValidado = async (body) => {
|
||||
);
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
throw new Error(
|
||||
'Este Servicio Social ya paso por el Registro Validado.'
|
||||
);
|
||||
case 6:
|
||||
throw new Error('Este Servicio Social ya finalizó.');
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
@@ -58,7 +59,7 @@ const registroValidado = async (body) => {
|
||||
);
|
||||
case 10:
|
||||
throw new Error(
|
||||
'Este Servicio Social esta cancelado. Comunicate con COESI para solucionar tu problema.'
|
||||
'Este Servicio Social fue cancelado. Comunicate con COESI para solucionar tu problema.'
|
||||
);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -66,31 +66,6 @@ ${dudas}`,
|
||||
};
|
||||
};
|
||||
|
||||
const registroRechazadoAlumno = (motivo, nombre) => {
|
||||
return {
|
||||
subject: 'Rechazo de registro.',
|
||||
msj: `Estimado(a) ${nombre}:
|
||||
|
||||
Te informamos que hay un error con tu registro de servicio social por los siguientes motivos:
|
||||
|
||||
${motivo}
|
||||
|
||||
${dudas}`,
|
||||
};
|
||||
};
|
||||
|
||||
const registroRechazadoResponsable = (motivo, nombre) => {
|
||||
return {
|
||||
subject: 'Rechazo de registro.',
|
||||
msj: `Estimado responsable de programa:
|
||||
Te informamos que hay un error con el registro de servicio social del alumno ${nombre} por los siguientes motivos:
|
||||
|
||||
${motivo}
|
||||
|
||||
${dudas}`,
|
||||
};
|
||||
};
|
||||
|
||||
const terminoValidado = (nombre) => {
|
||||
return {
|
||||
subject: 'Validación de término.',
|
||||
@@ -303,8 +278,6 @@ module.exports = {
|
||||
preRegistroRechazadoResponsable,
|
||||
registroValidadoAlumno,
|
||||
registroValidadoResponsable,
|
||||
registroRechazadoAlumno,
|
||||
registroRechazadoResponsable,
|
||||
terminoValidado,
|
||||
terminoRechazadoAlumno,
|
||||
terminoRechazadoResponsable,
|
||||
|
||||
Reference in New Issue
Block a user