return objeto

This commit is contained in:
Lemuel Marquez
2021-01-14 16:02:57 -06:00
parent 0de481b596
commit 49005c7b52
19 changed files with 70 additions and 105 deletions
@@ -150,9 +150,9 @@ const nuevo = async (body) => {
)
)
.then((res) => validar.validarPreTermino(idServicio))
.then((res) => {
return { message: `Se guardaron tus respuestas correctamente. ${res}` };
});
.then((res) => ({
message: `Se guardaron tus respuestas correctamente. ${res}`,
}));
};
module.exports = nuevo;
@@ -65,9 +65,9 @@ const nuevo = async (body) => {
)
)
.then((res) => validar.validarPreTermino(idServicio))
.then((res) => {
return { message: `Se guradaron tus respuestas correctamente. ${res}` };
});
.then((res) => ({
message: `Se guradaron tus respuestas correctamente. ${res}`,
}));
};
module.exports = nuevo;
+3 -3
View File
@@ -47,9 +47,9 @@ const cancelar = async (body) => {
)
)
.then((res) => Servicio.update({ idStatus: 10 }, { where: { idServicio } }))
.then((res) => {
return { message: 'Se cancelo correctamente este Servicio Social.' };
});
.then((res) => ({
message: 'Se cancelo correctamente este Servicio Social.',
}));
};
module.exports = cancelar;
@@ -51,11 +51,9 @@ const cartaTermino = async (body, file) => {
{ where: { idServicio } }
)
)
.then((res) => {
return {
message: `Se subio la Carta de Aceptación correctamente.`,
};
});
.then((res) => ({
message: `Se subio la Carta de Aceptación correctamente.`,
}));
};
module.exports = cartaTermino;
+3 -3
View File
@@ -48,9 +48,9 @@ const cartaTermino = async (body, file) => {
Servicio.update({ cartaTermino: res }, { where: { idServicio } })
)
.then((res) => validar.validarPreTermino(idServicio))
.then((res) => {
return { message: `Se subio la Carta de Termino correctamente. ${res}` };
});
.then((res) => ({
message: `Se subio la Carta de Termino correctamente. ${res}`,
}));
};
module.exports = cartaTermino;
+3 -3
View File
@@ -48,9 +48,9 @@ const informeGlobal = async (body, file) => {
Servicio.update({ informeGlobal: res }, { where: { idServicio } })
)
.then(async (res) => validar.validarPreTermino(idServicio))
.then((res) => {
return { message: `Se subio el Informe Global correctamente. ${res}` };
});
.then((res) => ({
message: `Se subio el Informe Global correctamente. ${res}`,
}));
};
module.exports = informeGlobal;
+4 -6
View File
@@ -47,12 +47,10 @@ const liberacion = async (body) => {
}
})
.then((res) => Servicio.update(update, { where: { idServicio } }))
.then((res) => {
return {
message:
'Se cambio de estatus correctamente y se envio un correo al alumno informandole de su liberación.',
};
});
.then((res) => ({
message:
'Se cambio de estatus correctamente y se envio un correo al alumno informandole de su liberación.',
}));
};
module.exports = liberacion;
+3 -5
View File
@@ -76,11 +76,9 @@ const nuevo = async (body, file) => {
programaInterno,
})
)
.then((res) => {
return {
message: `Se Pre-Registro correctamente al alumno.`,
};
});
.then((res) => ({
message: `Se Pre-Registro correctamente al alumno.`,
}));
};
module.exports = nuevo;
@@ -61,9 +61,9 @@ const cancelar = async (body) => {
{ where: { idServicio } }
)
)
.then((res) => {
return { message: 'Se rechazo correctamente la Carta de Aceptación.' };
});
.then((res) => ({
message: 'Se rechazo correctamente la Carta de Aceptación.',
}));
};
module.exports = cancelar;
@@ -62,9 +62,9 @@ const cancelar = async (body) => {
{ where: { idServicio } }
)
)
.then((res) => {
return { message: 'Se rechazo correctamente el Informe Global.' };
});
.then((res) => ({
message: 'Se rechazo correctamente el Informe Global.',
}));
};
module.exports = cancelar;
@@ -62,9 +62,9 @@ const cancelar = async (body) => {
{ where: { idServicio } }
)
)
.then((res) => {
return { message: 'Se rechazo correctamente la Carta de Termino.' };
});
.then((res) => ({
message: 'Se rechazo correctamente la Carta de Termino.',
}));
};
module.exports = cancelar;
+4 -6
View File
@@ -48,12 +48,10 @@ const registro = async (body) => {
);
})
.then((res) => Servicio.update({ idStatus: 2 }, { where: { idServicio } }))
.then((res) => {
return {
message:
'Se cambio de estatus correctamente y se envio un correo al alumno con sus credenciales.',
};
});
.then((res) => ({
message:
'Se cambio de estatus correctamente y se envio un correo al alumno con sus credenciales.',
}));
};
module.exports = registro;
@@ -74,12 +74,9 @@ const registroValidado = async (body) => {
{ where: { idServicio } }
)
)
.then((res) => {
return {
message:
'Haz terminado el registro de tu Servicio Social correctamente.',
};
});
.then((res) => ({
message: 'Haz terminado el registro de tu Servicio Social correctamente.',
}));
};
module.exports = registroValidado;
+3 -5
View File
@@ -57,11 +57,9 @@ const update = async (body, files) => {
);
return Servicio.update(dataUpdate, { where: { idServicio } });
})
.then((res) => {
return {
message: 'Se guadro correctamente los cambios de este servicio.',
};
});
.then((res) => ({
message: 'Se guadro correctamente los cambios de este servicio.',
}));
};
module.exports = update;
+6 -11
View File
@@ -5,7 +5,7 @@ const Usuario = require('../../db/tablas/Usuario');
const Carrera = require('../../db/tablas/Carrera');
const escolares = async (body) => {
let numeroCuenta = validar.validarNumeroCuenta(body.numeroCuenta);
const numeroCuenta = validar.validarNumeroCuenta(body.numeroCuenta);
let alumno;
return axios({
@@ -14,17 +14,14 @@ const escolares = async (body) => {
data: `${process.env.ESCOLARES_PASS}`,
})
.then((res) => {
let data = res.data;
// console.log(res);
if (!data.nombre || !data.carrconst || !data.avance)
if (!res.data.nombre || !res.data.carrconst || !res.data.avance)
throw new Error(
'El alumno no cumple con los requicitos para realizar el Servicio Social. Si cree que esto es erroneo comunicate con COESI.'
);
alumno = {
nombre: data.nombre.trim(),
creditos: data.avance,
carrera: data.carrconst.trim(),
nombre: res.data.nombre.trim(),
creditos: res.data.avance,
carrera: res.data.carrconst.trim(),
};
return Carrera.findOne({ where: { carrera: alumno.carrera } });
})
@@ -46,9 +43,7 @@ const escolares = async (body) => {
});
return res;
})
.then((res) => {
return { ...alumno, idUsuario: res.idUsuario };
});
.then((res) => ({ ...alumno, idUsuario: res.idUsuario }));
};
module.exports = escolares;
@@ -29,11 +29,9 @@ const newPasswordAlumno = async (body) => {
{ where: { idUsuario } }
)
)
.then((res) => {
return {
message: 'Se envio un correo con una contraseña nueva al alumno.',
};
});
.then((res) => ({
message: 'Se envio un correo con una contraseña nueva al alumno.',
}));
};
module.exports = newPasswordAlumno;
@@ -23,11 +23,9 @@ const newPasswordResponsable = async (body) => {
{ where: { idUsuario } }
)
)
.then((res) => {
return {
message: 'Se envio un correo con una contraseña nueva al responsable.',
};
});
.then((res) => ({
message: 'Se envio un correo con una contraseña nueva al responsable.',
}));
};
module.exports = newPasswordResponsable;
@@ -30,12 +30,10 @@ const responsableUpdate = async (body) => {
throw new Error('No se a envio nada para actualizar.');
return Usuario.update(dataUpdate, { where: { idUsuario } });
})
.then((res) => {
return {
message:
'Se actualizó la información de este responsable de programas correctamente.',
};
});
.then((res) => ({
message:
'Se actualizó la información de este responsable de programas correctamente.',
}));
};
module.exports = responsableUpdate;
+10 -21
View File
@@ -7,27 +7,15 @@ const Servicio = require('./tablas/Servicio');
const Usuario = require('./tablas/Usuario');
const guardar = async () => {
let idsProgramas = [];
let idsAlumnos = [];
let idsRegistros = [];
let responsables = await csv()
.fromFile('db/responsable.csv')
.then((res) => res);
let programas = await csv()
.fromFile('db/programa.csv')
.then((res) => res);
let alumnos = await csv()
.fromFile('db/alumno.csv')
.then((res) => res);
let registros = await csv()
.fromFile('db/registro.csv')
.then((res) => res);
let cuestionariosAlumno = await csv()
.fromFile('db/cuestionarioA.csv')
.then((res) => res);
let cuestionariosPrograma = await csv()
.fromFile('db/cuestionarioP.csv')
.then((res) => res);
const idsProgramas = [];
const idsAlumnos = [];
const idsRegistros = [];
const responsables = await csv().fromFile('db/responsable.csv');
let programas = await csv().fromFile('db/programa.csv');
let alumnos = await csv().fromFile('db/alumno.csv');
let registros = await csv().fromFile('db/registro.csv');
let cuestionariosAlumno = await csv().fromFile('db/cuestionarioA.csv');
let cuestionariosPrograma = await csv().fromFile('db/cuestionarioP.csv');
for (let i = 0; i < responsables.length; i++) {
await Usuario.create({
@@ -50,6 +38,7 @@ const guardar = async () => {
clavePrograma: programas[j].clavePrograma,
acatlan: responsables[i].acatlanContigo === 'true' ? true : false,
activo: true,
// activo: false,
idUsuario: res.dataValues.idUsuario,
})
.then((res) => {