escolares

This commit is contained in:
Tu Nombre
2025-02-07 18:07:41 -06:00
parent f6dc38c00f
commit 7e29a5e5b4
6 changed files with 699 additions and 29 deletions
+14
View File
@@ -36,11 +36,25 @@ const escolares = async (body) => {
const numeroCuenta = validarNumeroCuenta(body.numeroCuenta);
let alumno;
/*
return axios({
method: 'post',
url: `${process.env.ESCOLARES}${numeroCuenta}`,
data: `${process.env.ESCOLARES_PASS}`,
})
*/
return new Promise((res) => {
res({
data:{
nombre:"nombre",
carrconst:"Carrera",
avance:"avance"
}
})
})
.then((res) => {
if (!res.data.nombre || !res.data.carrconst || !res.data.avance)
throw new Error(
+50 -28
View File
@@ -5,8 +5,21 @@ const Programa = require('./tablas/Programa');
const correosExt = ['eithan.castillo@acatlan.unam.mx'];
const correosInt = ['316092940@pcpuma.acatlan.unam.mx'];
const nombresExt = ['Lemuel Rosas'];
const nombresInt = ['Lemuel Márquez'];
const nombresExt = ['responsable exterior'];
const nombresInt = ['responsable interno'];
const correosAdmin = ['unam.alternativo@gmail.com']
const nombresAdmin = ['admin1']
const correosEspecial = ['eithan.dev@gmail.com']
const nombresEspecial = ['Especial1']
@@ -14,28 +27,32 @@ const nombresInt = ['Lemuel Márquez'];
// create los admin son los encargados de cada programa
const createAdmin = async () => {
console.log('\nPaso 1) Instalando Responsables Externos falsos.'.bold.blue);
for (let i = 0; i < correosExt.length; i++) {
for (let i = 0; i < correosAdmin.length; i++) {
await Usuario.create({
usuario: correosExt[i],
idTipoUsuario: 2,
nombre: nombresExt[i],
usuario: correosAdmin[i],
idTipoUsuario: 1,
nombre: nombresAdmin[i],
password: encriptar.encriptar('qwertyui'),
activo: true,
}).then(async (res) => {
console.log(`Se inserto al responsable ${nombresExt[i]}`.magenta);
for (let j = 1; j <= 5; j++) {
await Programa.create({
institucion: `Institucion Falsa ${i + 1}`,
dependencia: `Dependencia Falsa ${j - i + 1}`,
programa: `Programa Falso ${j}`,
clavePrograma: `2020-${j}/${i + j + 1}-${i + j + 1}`,
idUsuario: res.dataValues.idUsuario,
});
console.log(
`Se inserto el programa ${j} del responsable ${i + 1}`.magenta
);
}
});
})
}
};
const createEspecial = async () => {
console.log('\nPaso 1) Instalando Responsables Externos falsos.'.bold.blue);
for (let i = 0; i < correosEspecial.length; i++) {
await Usuario.create({
usuario: correosEspecial[i],
idTipoUsuario: 4,
nombre: nombresEspecial[i],
password: encriptar.encriptar('qwertyui'),
activo: true,
})
}
};
@@ -43,12 +60,7 @@ const createAdmin = async () => {
const dataResponsableExt = async () => {
console.log('\nPaso 1) Instalando Responsables Externos falsos.'.bold.blue);
for (let i = 0; i < correosExt.length; i++) {
@@ -74,7 +86,9 @@ const dataResponsableExt = async () => {
}
});
}
};
};
const dataResponsableInt = async () => {
console.log('\nPaso 1) Instalando Responsables Internos falsos.'.bold.blue);
@@ -103,9 +117,17 @@ const dataResponsableInt = async () => {
}
};
const exec = async () => {
await dataResponsableExt();
await dataResponsableInt();
await createAdmin();
await createEspecial();
console.log(
'\nSe ha instalado exitosamente la informacion falsa.\n'.underline.bold
.green