Merge branch 'master' into dev

This commit is contained in:
Lemuel Márquez
2023-07-25 16:20:48 -06:00
8 changed files with 152 additions and 80 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ const liberacion = async (body) => {
.then((res) => CasoEspecial.update(update, { where: { idCasoEspecial } }))
.then((res) => ({
message:
'Se cambio de estatus correctamente y se envio un correo al alumno informandole de su liberación.',
'Se cambió de estatus correctamente y se envió un correo al alumno informandole de su liberación.',
}));
};
+1 -1
View File
@@ -35,7 +35,7 @@ const nuevo = async (body, file) => {
? validar.validarTexto(body.institucion, 'institucion', false, 200)
: '';
const dependencia = body.dependencia
? validar.validarTexto(body.dependencia, 'dependencia', false, 200)
? validar.validarAlfanumerico(body.dependencia, 'dependencia', false, 200)
: '';
const motivo = body.motivo
? validar.validarNumero(body.motivo, 'motivo', true, 1)
+4 -3
View File
@@ -4,6 +4,7 @@ const helperPath = '../../helper';
const helper = require(`${helperPath}/helper`);
const { validarNumero } = require(`${helperPath}/validar`);
const dbPath = '../../db/tablas';
const Carrera = require(`${dbPath}/Carrera`);
const CuestionarioAlumno = require(`${dbPath}/CuestionarioAlumno`);
const Programa = require(`${dbPath}/Programa`);
const Servicio = require(`${dbPath}/Servicio`);
@@ -22,6 +23,7 @@ const get = async (body) => {
},
{ model: Programa, where: { clavePrograma: { [Op.like]: `${year}%` } } },
{ model: Usuario },
{ model: Carrera },
],
order: [['createdAt']],
})
@@ -32,6 +34,7 @@ const get = async (body) => {
clavePrograma: res[i].Programa.clavePrograma,
usuario: res[i].Usuario.usuario,
nombre: res[i].Usuario.nombre,
carrera: res[i].Carrera.carrera,
idCuestionarioAlumno: res[i].CuestionarioAlumno.idCuestionarioAlumno,
sexo: res[i].CuestionarioAlumno.sexo,
edad: res[i].CuestionarioAlumno.edad,
@@ -73,9 +76,7 @@ const get = async (body) => {
});
return helper.crearArchivo(path, convertArrayToCSV(data));
})
.then((res) => {
return path;
});
.then((res) => path);
};
module.exports = get;
@@ -5,6 +5,7 @@ const helperPath = '../../helper';
const helper = require(`${helperPath}/helper`);
const { validarNumero } = require(`${helperPath}/validar`);
const dbPath = '../../db/tablas';
const Carrera = require(`${dbPath}/Carrera`);
const CuestionarioPrograma = require(`${dbPath}/CuestionarioPrograma`);
const Servicio = require(`${dbPath}/Servicio`);
const Programa = require(`${dbPath}/Programa`);
@@ -23,6 +24,7 @@ const get = async (body) => {
},
{ model: Programa, where: { clavePrograma: { [Op.like]: `${year}-%` } } },
{ model: Usuario },
{ model: Carrera },
],
order: [['createdAt']],
})
@@ -33,6 +35,7 @@ const get = async (body) => {
clavePrograma: res[i].Programa.clavePrograma,
usuario: res[i].Usuario.usuario,
nombre: res[i].Usuario.nombre,
carrera: res[i].Carrera.carrera,
idCuestionarioPrograma:
res[i].CuestionarioPrograma.idCuestionarioPrograma,
actividad1: res[i].CuestionarioPrograma.actividad1,
@@ -50,9 +53,7 @@ const get = async (body) => {
});
return helper.crearArchivo(path, convertArrayToCSV(data));
})
.then((res) => {
return path;
});
.then((res) => path);
};
module.exports = get;
+28 -24
View File
@@ -41,11 +41,8 @@ const nuevo = async (body, file) => {
const profesor = body.profesor
? validar.validarTexto(body.profesor, 'profesor', true, 50)
: '';
let carpeta = '';
return Usuario.findOne({
where: { idUsuario },
})
return Usuario.findOne({ where: { idUsuario } })
.then((res) => {
if (!res) throw new Error('Este alumno no existe en la db.');
if (res.idTipoUsuario !== 3)
@@ -65,19 +62,7 @@ const nuevo = async (body, file) => {
.then(async (res) => {
if (res)
throw new Error('Este alumno ya tienen un Servicio Social activo.');
return drive.folder(numeroCuenta);
})
.then((res) => {
carpeta = res;
return drive.uploadFile(
path,
`Carta_Aceptacion.pdf`,
'application/pdf',
carpeta
);
})
.then((res) =>
Servicio.create({
return Servicio.create({
idUsuario,
idPrograma,
idCarrera,
@@ -85,15 +70,34 @@ const nuevo = async (body, file) => {
correo,
fechaInicio: fechaInicio.format(),
fechaFin: fechaFin.format(),
carpeta,
cartaAceptacion: res,
carpeta: '',
cartaAceptacion: '',
profesor,
programaInterno,
})
)
.then((res) => ({
message: `Se Pre-Registro correctamente a este alumno alumno.`,
}));
});
})
.then((servicio) => {
let carpeta = '';
drive
.mkDir(numeroCuenta)
.then((res) => {
carpeta = res;
return drive.uploadFile(
path,
`Carta_Aceptacion.pdf`,
'application/pdf',
carpeta
);
})
.then((res) =>
Servicio.update(
{ carpeta, cartaAceptacion: res },
{ where: { idServicio: servicio.idServicio } }
)
);
return { message: `Se Pre-Registro correctamente a este alumno.` };
});
};
module.exports = nuevo;
+10 -10
View File
@@ -5,27 +5,27 @@ const dbPath = '../../db/tablas';
const Usuario = require(`${dbPath}/Usuario`);
const Carrera = require(`${dbPath}/Carrera`);
const creditosCarreras = [
{ carrera: 'LIC. EN ACTUARIA', creditos: 70 },
{ carrera: 'LIC. EN ACTUARIA', creditos: 64 },
{ carrera: 'LIC. EN ARQUITECTURA', creditos: 70 },
{ carrera: 'LIC. EN CIENCIAS POLITICAS Y ADMON PUB', creditos: 70 },
{ carrera: 'LIC. EN CIENCIAS POLITICAS Y ADMON.PUBL.', creditos: 70 },
{ carrera: 'LIC. EN CIENCIAS POLITICAS Y ADMON PUB', creditos: 67 },
{ carrera: 'LIC. EN CIENCIAS POLITICAS Y ADMON.PUBL.', creditos: 67 },
{ carrera: 'LIC. EN COMUNICACION', creditos: 67 },
{ carrera: 'LIC. EN DERECHO', creditos: 70 },
{ carrera: 'LIC. EN DERECHO (SUA)', creditos: 70 },
{ carrera: 'LIC. EN DERECHO', creditos: 68 },
{ carrera: 'LIC. EN DERECHO (SUA)', creditos: 67 },
{ carrera: 'LIC. EN DISEÑO GRAFICO', creditos: 70 },
{ carrera: 'LIC. EN ECONOMIA', creditos: 70 },
{ carrera: 'LIC. EN ENSEÑANZA DE INGLES', creditos: 70 },
{ carrera: 'LIC. EN ECONOMIA', creditos: 66 },
{ carrera: 'LIC. EN ENSEÑANZA DE INGLES', creditos: 69 },
{ carrera: 'LIC. EN FILOSOFIA', creditos: 70 },
{ carrera: 'LIC. EN HISTORIA', creditos: 70 },
{ carrera: 'LIC. EN INGENIERIA CIVIL', creditos: 70 },
{ carrera: 'LIC. EN LENGUA Y LITERATURA HISPANICAS', creditos: 70 },
{ carrera: 'LIC. EN MAT. APLICADAS Y COMPUTACION', creditos: 68 },
{ carrera: 'LIC. EN MATEMATICAS APLICADAS Y COMP.', creditos: 68 },
{ carrera: 'LIC. EN MAT. APLICADAS Y COMPUTACION', creditos: 66 },
{ carrera: 'LIC. EN MATEMATICAS APLICADAS Y COMP.', creditos: 66 },
{ carrera: 'LIC. EN PEDAGOGÍA', creditos: 70 },
{ carrera: 'LIC. EN PERIODISMO Y COMUNICACION COL.', creditos: 70 },
{ carrera: 'LIC. EN RELACIONES INTERNACIONALES', creditos: 70 },
{ carrera: 'LIC. EN RELACIONES INTERNACIONALES (SUA)', creditos: 70 },
{ carrera: 'LIC. EN SOCIOLOGIA', creditos: 70 },
{ carrera: 'LIC. EN SOCIOLOGIA', creditos: 68 },
{ carrera: 'LIC. ENSEÑANZA DE ALEMÁN (LENG. EXTRANJS', creditos: 70 },
{ carrera: 'LIC. ENSEÑANZA DE ESPAÑOL(LENG. EXTRANJ)', creditos: 70 },
{ carrera: 'LIC. ENSEÑANZA DE INGLÉS(LENG. EXTRANJE)', creditos: 70 },