produccion
This commit is contained in:
Generated
+32
@@ -19,6 +19,7 @@
|
||||
"dotenv": "^8.2.0",
|
||||
"express": "^4.17.1",
|
||||
"fs": "^0.0.1-security",
|
||||
"gmail-send": "^1.8.14",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"mariadb": "^2.5.3",
|
||||
"moment": "^2.29.1",
|
||||
@@ -1071,6 +1072,15 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/gmail-send": {
|
||||
"version": "1.8.14",
|
||||
"resolved": "https://registry.npmjs.org/gmail-send/-/gmail-send-1.8.14.tgz",
|
||||
"integrity": "sha512-hc+4Ej7ZJtw0G5sync10pmWkpPXIabkQ+p/a92lPPTXni3ChEU9sR2wxOvK6Hx+5Ou+2m9h1cVffWEgtR6Gzkw==",
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.21",
|
||||
"nodemailer": "^6.6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/got": {
|
||||
"version": "9.6.0",
|
||||
"resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz",
|
||||
@@ -1757,6 +1767,14 @@
|
||||
"node": "4.x || >=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/nodemailer": {
|
||||
"version": "6.7.2",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.7.2.tgz",
|
||||
"integrity": "sha512-Dz7zVwlef4k5R71fdmxwR8Q39fiboGbu3xgswkzGwczUfjp873rVxt1O46+Fh0j1ORnAC6L9+heI8uUpO6DT7Q==",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/nodemon": {
|
||||
"version": "2.0.15",
|
||||
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.15.tgz",
|
||||
@@ -3558,6 +3576,15 @@
|
||||
"ini": "2.0.0"
|
||||
}
|
||||
},
|
||||
"gmail-send": {
|
||||
"version": "1.8.14",
|
||||
"resolved": "https://registry.npmjs.org/gmail-send/-/gmail-send-1.8.14.tgz",
|
||||
"integrity": "sha512-hc+4Ej7ZJtw0G5sync10pmWkpPXIabkQ+p/a92lPPTXni3ChEU9sR2wxOvK6Hx+5Ou+2m9h1cVffWEgtR6Gzkw==",
|
||||
"requires": {
|
||||
"lodash": "^4.17.21",
|
||||
"nodemailer": "^6.6.5"
|
||||
}
|
||||
},
|
||||
"got": {
|
||||
"version": "9.6.0",
|
||||
"resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz",
|
||||
@@ -4092,6 +4119,11 @@
|
||||
"whatwg-url": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"nodemailer": {
|
||||
"version": "6.7.2",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.7.2.tgz",
|
||||
"integrity": "sha512-Dz7zVwlef4k5R71fdmxwR8Q39fiboGbu3xgswkzGwczUfjp873rVxt1O46+Fh0j1ORnAC6L9+heI8uUpO6DT7Q=="
|
||||
},
|
||||
"nodemon": {
|
||||
"version": "2.0.15",
|
||||
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.15.tgz",
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
"dotenv": "^8.2.0",
|
||||
"express": "^4.17.1",
|
||||
"fs": "^0.0.1-security",
|
||||
"gmail-send": "^1.8.14",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"mariadb": "^2.5.3",
|
||||
"moment": "^2.29.1",
|
||||
|
||||
@@ -8,17 +8,17 @@ const pool = mariadb.createPool({
|
||||
database: process.env.SAT_DB,
|
||||
});
|
||||
|
||||
const obtenerIdCarrera = async (numeroCuenta) => {
|
||||
const obtenerDatosUsr = async (numeroCuenta) => {
|
||||
const conn = await pool.getConnection().catch((err) => {
|
||||
throw new Error('No se pudo conectar con la db. ' + err);
|
||||
});
|
||||
|
||||
return conn
|
||||
.query(`SELECT id_carrera FROM alumno WHERE id_cuenta = ${numeroCuenta}`)
|
||||
.query(
|
||||
`SELECT id_carrera, generacion FROM alumno WHERE id_cuenta = ${numeroCuenta}`
|
||||
)
|
||||
.then((rows) => {
|
||||
conn.end();
|
||||
// console.log(rows[0]);
|
||||
// if (rows[0].length === 0) return null;
|
||||
return rows[0];
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -63,4 +63,4 @@ const usuarioInscrito = async (numeroCuenta, realizoPago) => {
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = { obtenerIdCarrera, obtenerCarrera, usuarioInscrito };
|
||||
module.exports = { obtenerDatosUsr, obtenerCarrera, usuarioInscrito };
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
const dbPath = '../../db/tablas';
|
||||
const { validarNumeroEntero } = require('../../helper/validar');
|
||||
const { Op } = require('sequelize');
|
||||
const Inscripcion = require(`${dbPath}/Inscripcion`);
|
||||
|
||||
const actualizarTicket = async (body) => {
|
||||
const idInscripcion = validarNumeroEntero(
|
||||
body.idInscripcion,
|
||||
'id Inscripcion',
|
||||
true
|
||||
);
|
||||
const monto = validarNumeroEntero(body.monto, 'monto', true);
|
||||
const folio = validarNumeroEntero(body.folio, 'folio', true);
|
||||
|
||||
return Inscripcion.findOne({
|
||||
where: {
|
||||
idInscripcion,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('No pudimos encontrar este ticket.');
|
||||
return Inscripcion.findOne({
|
||||
where: {
|
||||
folio,
|
||||
cancelacion: 0,
|
||||
idInscripcion: { [Op.ne]: idInscripcion },
|
||||
},
|
||||
});
|
||||
})
|
||||
.then((res) => {
|
||||
if (res)
|
||||
throw new Error('¡ Este folio ya fue utilizado por otra inscripción !');
|
||||
})
|
||||
.then((res) => {
|
||||
return Inscripcion.update(
|
||||
{
|
||||
folio,
|
||||
monto,
|
||||
fechaTicket: body.fechaTicket,
|
||||
},
|
||||
{
|
||||
where: {
|
||||
idInscripcion,
|
||||
},
|
||||
}
|
||||
);
|
||||
})
|
||||
.then((res) => ({
|
||||
message:
|
||||
'¡ Los datos de la inscripción fueron actualizados de forma correcta !',
|
||||
}))
|
||||
.catch((err) => {
|
||||
throw new Error('No fue posible actualizar los datos del ticket. ' + err);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = actualizarTicket;
|
||||
@@ -0,0 +1,36 @@
|
||||
const dbPath = '../../db/tablas';
|
||||
const Inscripcion = require(`${dbPath}/Inscripcion`);
|
||||
const { validarNumeroEntero } = require('../../helper/validar');
|
||||
|
||||
const cancelarInscripcion = async (body) => {
|
||||
const idInscripcion = validarNumeroEntero(
|
||||
body.idInscripcion,
|
||||
'id Inscripcion',
|
||||
true
|
||||
);
|
||||
|
||||
return Inscripcion.findOne({
|
||||
where: { idInscripcion },
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('Lo sentimos esta inscripción no existe.');
|
||||
return Inscripcion.update(
|
||||
{
|
||||
cancelacion: 1,
|
||||
},
|
||||
{
|
||||
where: {
|
||||
idInscripcion,
|
||||
},
|
||||
}
|
||||
);
|
||||
})
|
||||
.then((res) => ({
|
||||
message: '¡ Esta inscripción fue cancelada de forma correcta !',
|
||||
}))
|
||||
.catch((err) => {
|
||||
throw new Error('¡ No fue posible validar la inscripción !. ');
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = cancelarInscripcion;
|
||||
@@ -0,0 +1,23 @@
|
||||
const { validarNumeroEntero } = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Inscripcion = require(`${dbPath}/Inscripcion`);
|
||||
|
||||
const motivo = async (body) => {
|
||||
const folio = validarNumeroEntero(body.folio, 'folio', true);
|
||||
|
||||
return Inscripcion.findOne({
|
||||
where: { folio },
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('No pudimos encontrar este ticket.');
|
||||
return Inscripcion.findOne({
|
||||
where: { folio, validacion: 0 },
|
||||
attributes: ['motivo'],
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new Error('No fue posible encontrar el ticket. ' + err);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = motivo;
|
||||
@@ -29,30 +29,17 @@ const reporte = async (body) => {
|
||||
],
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (body.tipo === 'CSV') {
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
data.push({
|
||||
numero_cuenta: res[i].Usuario.numeroCuenta,
|
||||
id_area: res[i].idArea,
|
||||
folio: res[i].folio,
|
||||
monto: res[i].monto,
|
||||
hizo_pago: res[i].hizoPago,
|
||||
fecha_inscripcion: moment(res[i].fechaInscripcion).format('L'),
|
||||
});
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
data.push({
|
||||
numeroCuenta: res[i].Usuario.numeroCuenta,
|
||||
validacion: res[i].validacion,
|
||||
confirmacion: res[i].confirmacion,
|
||||
folio: res[i].folio,
|
||||
monto: res[i].monto,
|
||||
hizoPago: res[i].hizoPago,
|
||||
fechaInscripcion: moment(res[i].fechaInscripcion).format('L'),
|
||||
idArea: res[i].idArea,
|
||||
});
|
||||
}
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
data.push({
|
||||
numeroCuenta: res[i].Usuario.numeroCuenta,
|
||||
idArea: res[i].idArea,
|
||||
folio: res[i].folio,
|
||||
monto: res[i].monto,
|
||||
hizoPago: res[i].hizoPago,
|
||||
fechaInscripcion: moment(res[i].fechaInscripcion).format('L'),
|
||||
validacion: res[i].validacion,
|
||||
motivoDeclinacion: res[i].motivo,
|
||||
});
|
||||
}
|
||||
await helper.eliminarArchivo(path).catch((err) => {});
|
||||
return helper.crearArchivo(path, convertArrayToCSV(data));
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
const { validarNumeroEntero } = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
const Inscripcion = require(`${dbPath}/Inscripcion`);
|
||||
|
||||
const ticket = async (body) => {
|
||||
const folio = validarNumeroEntero(body.folio, 'folio', true);
|
||||
|
||||
return Inscripcion.findOne({
|
||||
where: { folio: body.folio },
|
||||
attributes: ['rutaTicket', 'extension'],
|
||||
attributes: ['rutaTicket', 'extension', 'motivo'],
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('No pudimos encontrar este ticket.');
|
||||
return { rutaTicket: res.rutaTicket, extension: res.extension };
|
||||
return {
|
||||
rutaTicket: res.rutaTicket,
|
||||
extension: res.extension,
|
||||
motivo: res.motivo,
|
||||
};
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new Error('No fue posible validar el ticket. ' + err);
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
const validar = require('../../helper/validar');
|
||||
const { validarNumeroEntero } = require('../../helper/validar');
|
||||
const { Op } = require('sequelize');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
const Inscripcion = require(`${dbPath}/Inscripcion`);
|
||||
|
||||
const todasInscripciones = async (body) => {
|
||||
const validacion = validarNumeroEntero(body.validacion, 'validacion', true);
|
||||
return Inscripcion.findAll({
|
||||
where: { validacion: body.validacion },
|
||||
where: { validacion, cancelacion: 0 },
|
||||
include: [
|
||||
{
|
||||
model: Usuario,
|
||||
|
||||
@@ -1,26 +1,21 @@
|
||||
const dbPath = '../../db/tablas';
|
||||
const Inscripcion = require(`${dbPath}/Inscripcion`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
const { usuarioInscrito } = require('../../config/mariadb.conf');
|
||||
const { validarNumeroEntero } = require('../../helper/helper');
|
||||
|
||||
const validarSinTicket = async (body) => {
|
||||
return usuarioInscrito(body.numeroCuenta, 0)
|
||||
.then((res) => {
|
||||
return Inscripcion.update(
|
||||
{
|
||||
validacion: 1,
|
||||
},
|
||||
{
|
||||
where: {
|
||||
idUsuario: body.idUsuario,
|
||||
validacion: 2,
|
||||
},
|
||||
}
|
||||
);
|
||||
})
|
||||
const idUsuario = validarNumeroEntero(body.idUsuario, 'usuario', true);
|
||||
return Inscripcion.update(
|
||||
{
|
||||
validacion: 1,
|
||||
},
|
||||
{
|
||||
where: {
|
||||
idUsuario,
|
||||
},
|
||||
}
|
||||
)
|
||||
.then((res) => ({
|
||||
message:
|
||||
'Tu inscripción está sujeta a validación, en caso de no ser correcta o veraz el servicio será suspendido.',
|
||||
message: '¡El ticket a sido validado de forma correcta!',
|
||||
}))
|
||||
.catch((err) => {
|
||||
throw new Error('¡ No fue posible validar la inscripción !. ');
|
||||
|
||||
@@ -1,50 +1,57 @@
|
||||
const { validarNumeroEntero } = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Inscripcion = require(`${dbPath}/Inscripcion`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
const { usuarioInscrito } = require('../../config/mariadb.conf');
|
||||
|
||||
const validarTicket = async (body) => {
|
||||
const validacion = validarNumeroEntero(body.validacion, 'validacion', true);
|
||||
const folio = validarNumeroEntero(body.folio, 'folio', true);
|
||||
|
||||
return Inscripcion.findOne({
|
||||
where: { folio: body.folio },
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('Este folio no existe');
|
||||
idUsuario = res.idUsuario;
|
||||
return Inscripcion.findOne({
|
||||
where: { folio: body.folio, validacion: 1 },
|
||||
});
|
||||
if (validacion == 1) {
|
||||
return Inscripcion.findOne({
|
||||
where: { folio, validacion: 1 },
|
||||
});
|
||||
}
|
||||
})
|
||||
.then((res) => {
|
||||
if (res) throw new Error('Este folio ya fue validado');
|
||||
return Inscripcion.update(
|
||||
{
|
||||
validacion: body.validacion,
|
||||
validacion,
|
||||
},
|
||||
{
|
||||
where: {
|
||||
folio: body.folio,
|
||||
validacion: 2,
|
||||
folio,
|
||||
},
|
||||
}
|
||||
);
|
||||
})
|
||||
.then((res) => {
|
||||
if (body.validacion === 0)
|
||||
throw new Error(
|
||||
'El administrador a declinado el ticket, ya que los datos no coinciden.'
|
||||
if (body.validacion === 0) {
|
||||
return Inscripcion.update(
|
||||
{ motivo: body.motivo },
|
||||
{
|
||||
where: {
|
||||
folio: body.folio,
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
})
|
||||
.then((res) => {
|
||||
return Usuario.findOne({
|
||||
where: { idUsuario },
|
||||
attributes: ['numeroCuenta'],
|
||||
}).then((res) => {
|
||||
return usuarioInscrito(res.numeroCuenta, 1).then(async (res) => {
|
||||
return {
|
||||
message: '¡ El ticket a sido validado de forma correcta !',
|
||||
};
|
||||
});
|
||||
});
|
||||
if (body.validacion === 1)
|
||||
return {
|
||||
message: '¡El ticket a sido validado de forma correcta!',
|
||||
};
|
||||
else
|
||||
return {
|
||||
message: '¡El ticket a sido declinado',
|
||||
};
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new Error('No fue posible validar el ticket. ' + err);
|
||||
|
||||
@@ -1,35 +1,38 @@
|
||||
const { obtenerDatosUsr } = require('../../config/mariadb.conf');
|
||||
const {
|
||||
obtenerIdCarrera,
|
||||
obtenerCarrera,
|
||||
} = require('../../config/mariadb.conf');
|
||||
const validar = require('../../helper/validar');
|
||||
validarNumeroCuenta,
|
||||
validarNumeroEntero,
|
||||
} = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Carrera = require(`${dbPath}/Carrera`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const escolares = async (body) => {
|
||||
const numeroCuenta = validarNumeroCuenta(
|
||||
body.numeroCuenta,
|
||||
'numero cuenta',
|
||||
true
|
||||
);
|
||||
return Usuario.findOne({
|
||||
where: { numeroCuenta: body.numeroCuenta },
|
||||
where: { numeroCuenta },
|
||||
}).then((res) => {
|
||||
if (!res) {
|
||||
return obtenerIdCarrera(body.numeroCuenta).then(async (res) => {
|
||||
return obtenerDatosUsr(numeroCuenta).then(async (res) => {
|
||||
return Usuario.create({
|
||||
idUsuario: body.idUsuario,
|
||||
numeroCuenta: body.numeroCuenta,
|
||||
numeroCuenta,
|
||||
nombre: body.nombre,
|
||||
semestre: 8,
|
||||
generacion: res.generacion,
|
||||
carrera: body.carrera,
|
||||
idCarrera: res.id_carrera,
|
||||
});
|
||||
});
|
||||
}
|
||||
return Usuario.findOne({
|
||||
where: { numeroCuenta: body.numeroCuenta },
|
||||
where: { numeroCuenta },
|
||||
attributes: [
|
||||
'idUsuario',
|
||||
'numeroCuenta',
|
||||
'nombre',
|
||||
'semestre',
|
||||
'generacion',
|
||||
'idCarrera',
|
||||
'carrera',
|
||||
],
|
||||
|
||||
@@ -2,7 +2,8 @@ const moment = require('moment');
|
||||
const fs = require('fs');
|
||||
const { validarNumeroEntero, validarNumero } = require('../../helper/validar');
|
||||
const { eliminarArchivo } = require('../../helper/helper');
|
||||
const { usuarioInscrito } = require('../../config/mariadb.conf');
|
||||
const gmail = require('../../helper/gmail');
|
||||
const correoInscripciones = require('../../helper/correo');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Inscripcion = require(`${dbPath}/Inscripcion`);
|
||||
|
||||
@@ -13,15 +14,20 @@ const inscripcion = async (body, file) => {
|
||||
const monto = validarNumero(body.monto, 'monto', true);
|
||||
const folio = body.folio;
|
||||
|
||||
let correo = {};
|
||||
let email = '';
|
||||
|
||||
return Inscripcion.findOne({
|
||||
where: { folio },
|
||||
where: { folio, cancelacion: 0 },
|
||||
})
|
||||
.then((res) => {
|
||||
if (res) throw new Error('Este folio ya esta registrado');
|
||||
return Inscripcion.findOne({
|
||||
where: { idUsuario, idArea },
|
||||
where: { idUsuario, idArea, cancelacion: 0 },
|
||||
}).then((res) => {
|
||||
if (res) throw new Error('Ya estas registrado en esta área');
|
||||
email = `${body.numeroCuenta}@pcpuma.acatlan.unam.mx`;
|
||||
correo = correoInscripciones();
|
||||
if (file && folio && body.fechaTicket) {
|
||||
return Inscripcion.create({
|
||||
idUsuario,
|
||||
@@ -47,10 +53,11 @@ const inscripcion = async (body, file) => {
|
||||
.then((res) => {
|
||||
if (file)
|
||||
fs.renameSync(file.path, file.path + '.' + file.mimetype.split('/')[1]);
|
||||
return gmail(correo.subject, email, correo.msj);
|
||||
})
|
||||
.then((res) => ({
|
||||
message:
|
||||
'Tu inscripción está sujeta a validación, en caso de no ser correcta o veraz el servicio será suspendido.',
|
||||
'Tu inscripción está sujeta a validación, en caso de no ser correcta o veraz el servicio será suspendido. Por favor revisa tu correo de PCPUMA para confirmar tu registro.',
|
||||
}))
|
||||
.catch((err) => {
|
||||
if (file) eliminarArchivo(file.path);
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
const validar = require('../../helper/validar');
|
||||
const { validarNumeroEntero } = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Carrera = require(`${dbPath}/Carrera`);
|
||||
const Inscripcion = require(`${dbPath}/Inscripcion`);
|
||||
|
||||
const inscripciones = async (body) => {
|
||||
const idUsuario = validarNumeroEntero(body.idUsuario, 'Usuario', true);
|
||||
|
||||
return Inscripcion.findAll({
|
||||
where: { idUsuario: body.idUsuario },
|
||||
where: { idUsuario },
|
||||
}).then((res) => {
|
||||
if (!res) return [];
|
||||
return Inscripcion.findAll({
|
||||
where: { idUsuario: body.idUsuario },
|
||||
where: { idUsuario, cancelacion: 0 },
|
||||
attributes: [
|
||||
'idInscripcion',
|
||||
'validacion',
|
||||
'confirmacion',
|
||||
'folio',
|
||||
'monto',
|
||||
'idUsuario',
|
||||
|
||||
@@ -13,7 +13,6 @@ const login = async (body) => {
|
||||
passwordUser: body.passwordUser,
|
||||
};
|
||||
|
||||
console.log(numeroCuenta, body.passwordUser);
|
||||
return axios
|
||||
.post(
|
||||
`https://venus.acatlan.unam.mx/conexionEscolares_test/ingresarAlumno`,
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
const Usuario = require('./tablas/Usuario');
|
||||
const { encriptar } = require('../helper/encriptar');
|
||||
|
||||
const dataUsuarios = async () => {
|
||||
let usuario = ['416313221', '111111111', '222222222'];
|
||||
let nombre = [
|
||||
'Adriana De Luna Ramirez',
|
||||
'Nombre Falso 1',
|
||||
'Nombre Falso 2',
|
||||
];
|
||||
|
||||
for (let i = 0; i < usuario.length; i++) {
|
||||
await Usuario.create({
|
||||
usuario: usuario[i],
|
||||
nombre: nombre[i],
|
||||
password: encriptar('holi'),
|
||||
idTipoUsuario: 2,
|
||||
});
|
||||
console.log(`Se insertó el usuario ${usuario[i]}.`.magenta);
|
||||
}
|
||||
};
|
||||
|
||||
const exec = async () => {
|
||||
await dataUsuarios();
|
||||
console.log(
|
||||
'\nSe ha instalado exitosamente la información falsa en la base de datos.\n'
|
||||
.underline.bold.green
|
||||
);
|
||||
process.exit();
|
||||
};
|
||||
|
||||
exec();
|
||||
@@ -18,16 +18,18 @@ Inscripcion.init(
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: 2,
|
||||
},
|
||||
confirmacion: {
|
||||
cancelacion: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
allowNull: false,
|
||||
defaultValue: false,
|
||||
defaultValue: 0,
|
||||
},
|
||||
motivo: {
|
||||
type: DataTypes.STRING(100),
|
||||
defaultValue: null,
|
||||
},
|
||||
folio: {
|
||||
type: DataTypes.STRING(10),
|
||||
allowNull: true,
|
||||
defaultValue: null,
|
||||
unique: true,
|
||||
},
|
||||
monto: {
|
||||
type: DataTypes.INTEGER,
|
||||
|
||||
@@ -22,8 +22,8 @@ Usuario.init(
|
||||
allowNull: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
semestre: {
|
||||
type: DataTypes.STRING(30),
|
||||
generacion: {
|
||||
type: DataTypes.STRING(5),
|
||||
allowNull: false,
|
||||
},
|
||||
idCarrera: {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
const correoInscripciones = () => ({
|
||||
subject: `Inscripción a CEDETEC`,
|
||||
msj: `
|
||||
<p>Estimado Usuario</p>
|
||||
<p>
|
||||
Su inscripción esta sujeta a revisión, es necesario revisar los datos que registro en el sistema.
|
||||
</p>
|
||||
|
||||
<p>Te sugerimos guardar tu ticket para cualquier aclaración</p>
|
||||
|
||||
<p>Por el momento podras hacer tu confirmación en <a href="https://kalinga.acatlan.unam.mx/cedetec/" target="_blanc">KALINGA</a></p>
|
||||
|
||||
<p>En caso de recibir un correo con el asunto Inscripción declinada se cancelara el servicio y no podras hacer uso de los servicios</p>
|
||||
|
||||
<p>Atentamente:</p>
|
||||
<p>Atención Usuarios DSC</p>
|
||||
`,
|
||||
});
|
||||
|
||||
module.exports = correoInscripciones;
|
||||
@@ -5,11 +5,10 @@ const send = require('gmail-send')({
|
||||
pass: process.env.GMAILPASSWORD,
|
||||
});
|
||||
|
||||
const gmail = (subject, to, text) => {
|
||||
const gmail = (subject, to, html) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
send({ subject, to, text }, (error, result, fullResult) => {
|
||||
send({ subject, to, html }, (error, result, fullResult) => {
|
||||
if (error) reject(error);
|
||||
console.log(fullResult);
|
||||
resolve(result);
|
||||
});
|
||||
});
|
||||
|
||||
+33
-1
@@ -1,13 +1,15 @@
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
const fs = require('fs');
|
||||
const { validarAlfanumerico } = require('../helper/validar');
|
||||
const { verificaToken } = require('../middleware/autentificacion');
|
||||
const route = '/Admin';
|
||||
const controllerPath = '../controller/Admin';
|
||||
const login = require(`${controllerPath}/login`);
|
||||
const todasInscripciones = require(`${controllerPath}/todasInscripciones`);
|
||||
const ticket = require(`${controllerPath}/ticket`);
|
||||
const actualizarTicket = require(`${controllerPath}/actualizarTicket`);
|
||||
const cancelarInscripcion = require(`${controllerPath}/cancelarInscripcion`);
|
||||
const motivo = require(`${controllerPath}/motivo`);
|
||||
const validarSinTicket = require(`${controllerPath}/validarSinTicket`);
|
||||
const validarTicket = require(`${controllerPath}/validarTicket`);
|
||||
const reporte = require(`${controllerPath}/reporte`);
|
||||
@@ -45,6 +47,36 @@ app.get(`${route}/ticket`, (req, res) => {
|
||||
});
|
||||
});
|
||||
|
||||
app.get(`${route}/motivo`, verificaToken, (req, res) => {
|
||||
return motivo(req.query)
|
||||
.then((data) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
res.status(400).json({ message: err.message });
|
||||
});
|
||||
});
|
||||
|
||||
app.put(`${route}/actualizar_ticket`, verificaToken, (req, res) => {
|
||||
return actualizarTicket(req.body)
|
||||
.then((data) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
res.status(400).json({ message: err.message });
|
||||
});
|
||||
});
|
||||
|
||||
app.put(`${route}/cancelar_inscripcion`, verificaToken, (req, res) => {
|
||||
return cancelarInscripcion(req.body)
|
||||
.then((data) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
res.status(400).json({ message: err.message });
|
||||
});
|
||||
});
|
||||
|
||||
app.put(`${route}/validar`, verificaToken, (req, res) => {
|
||||
return validarTicket(req.body)
|
||||
.then((data) => {
|
||||
|
||||
Reference in New Issue
Block a user