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.' };
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ const Servicio = require('../../db/tablas/Servicio');
|
||||
|
||||
const cartaTermino = async (body, file) => {
|
||||
let idServicio = validar.validarId(body.idServicio);
|
||||
let path = `./server/uploads/${validar.validar(file, 'El archivo', 1000)}`;
|
||||
|
||||
return Servicio.findOne({
|
||||
where: { idServicio },
|
||||
@@ -14,12 +15,6 @@ const cartaTermino = async (body, file) => {
|
||||
throw new Error('Ya se subio la Carta de Aceptación.');
|
||||
switch (res.idStatus) {
|
||||
case 7:
|
||||
let path = `./server/uploads/${validar.validar(
|
||||
file,
|
||||
'El archivo',
|
||||
1000
|
||||
)}`;
|
||||
|
||||
return drive.uploadFile(
|
||||
path,
|
||||
`Carta_Aceptacion.pdf`,
|
||||
@@ -50,12 +45,12 @@ const cartaTermino = async (body, file) => {
|
||||
);
|
||||
}
|
||||
})
|
||||
.then((res) => {
|
||||
return Servicio.update(
|
||||
.then((res) =>
|
||||
Servicio.update(
|
||||
{ cartaAceptacion: res, idStatus: 1 },
|
||||
{ where: { idServicio } }
|
||||
);
|
||||
})
|
||||
)
|
||||
)
|
||||
.then((res) => {
|
||||
return {
|
||||
message: `Se subio la Carta de Aceptación correctamente.`,
|
||||
|
||||
@@ -4,6 +4,7 @@ const Servicio = require('../../db/tablas/Servicio');
|
||||
|
||||
const cartaTermino = async (body, file) => {
|
||||
let idServicio = validar.validarId(body.idServicio);
|
||||
let path = `./server/uploads/${validar.validar(file, 'El archivo', 1000)}`;
|
||||
|
||||
return Servicio.findOne({
|
||||
where: { idServicio },
|
||||
@@ -14,12 +15,6 @@ const cartaTermino = async (body, file) => {
|
||||
switch (res.idStatus) {
|
||||
case 4:
|
||||
case 8:
|
||||
let path = `./server/uploads/${validar.validar(
|
||||
file,
|
||||
'El archivo',
|
||||
1000
|
||||
)}`;
|
||||
|
||||
return drive.uploadFile(
|
||||
path,
|
||||
`Carta_Termino.pdf`,
|
||||
@@ -49,12 +44,10 @@ const cartaTermino = async (body, file) => {
|
||||
);
|
||||
}
|
||||
})
|
||||
.then((res) => {
|
||||
return Servicio.update({ cartaTermino: res }, { where: { idServicio } });
|
||||
})
|
||||
.then((res) => {
|
||||
return validar.validarPreTermino(idServicio);
|
||||
})
|
||||
.then((res) =>
|
||||
Servicio.update({ cartaTermino: res }, { where: { idServicio } })
|
||||
)
|
||||
.then((res) => validar.validarPreTermino(idServicio))
|
||||
.then((res) => {
|
||||
return { message: `Se subio la Carta de Termino correctamente. ${res}` };
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ const Servicio = require('../../db/tablas/Servicio');
|
||||
|
||||
const informeGlobal = async (body, file) => {
|
||||
let idServicio = validar.validarId(body.idServicio);
|
||||
let path = `./server/uploads/${validar.validar(file, 'El archivo', 1000)}`;
|
||||
|
||||
return Servicio.findOne({
|
||||
where: { idServicio },
|
||||
@@ -14,12 +15,6 @@ const informeGlobal = async (body, file) => {
|
||||
switch (res.idStatus) {
|
||||
case 4:
|
||||
case 9:
|
||||
let path = `./server/uploads/${validar.validar(
|
||||
file,
|
||||
'El archivo',
|
||||
1000
|
||||
)}`;
|
||||
|
||||
return drive.uploadFile(
|
||||
path,
|
||||
`Informe_Global.pdf`,
|
||||
@@ -49,15 +44,10 @@ const informeGlobal = async (body, file) => {
|
||||
);
|
||||
}
|
||||
})
|
||||
.then((res) => {
|
||||
return Servicio.update(
|
||||
{ informeGlobal: res },
|
||||
{ where: { idServicio } }
|
||||
);
|
||||
})
|
||||
.then(async (res) => {
|
||||
return validar.validarPreTermino(idServicio);
|
||||
})
|
||||
.then((res) =>
|
||||
Servicio.update({ informeGlobal: res }, { where: { idServicio } })
|
||||
)
|
||||
.then(async (res) => validar.validarPreTermino(idServicio))
|
||||
.then((res) => {
|
||||
return { message: `Se subio el Informe Global correctamente. ${res}` };
|
||||
});
|
||||
|
||||
@@ -14,12 +14,10 @@ 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.'
|
||||
);
|
||||
|
||||
switch (res.idStatus) {
|
||||
case 5:
|
||||
let correo = correos.terminoValidado(res.Usuario.nombre);
|
||||
|
||||
@@ -61,8 +61,8 @@ const nuevo = async (body, file) => {
|
||||
carpeta
|
||||
);
|
||||
})
|
||||
.then((res) => {
|
||||
return Servicio.create({
|
||||
.then((res) =>
|
||||
Servicio.create({
|
||||
idUsuario,
|
||||
idPrograma,
|
||||
idCarrera,
|
||||
@@ -74,8 +74,8 @@ const nuevo = async (body, file) => {
|
||||
cartaAceptacion: res,
|
||||
profesor,
|
||||
programaInterno,
|
||||
});
|
||||
})
|
||||
})
|
||||
)
|
||||
.then((res) => {
|
||||
return {
|
||||
message: `Se Pre-Registro correctamente al alumno.`,
|
||||
|
||||
Reference in New Issue
Block a user