borrar
This commit is contained in:
@@ -27,23 +27,6 @@ const obtenerDatosUsr = async (numeroCuenta) => {
|
||||
});
|
||||
};
|
||||
|
||||
const obtenerCarrera = async (idCarrera) => {
|
||||
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 carrera WHERE id_carrera = ${idCarrera}`)
|
||||
.then((rows) => {
|
||||
conn.end();
|
||||
return rows[0];
|
||||
})
|
||||
.catch((err) => {
|
||||
conn.end();
|
||||
throw new Error('Hubo un problema con el querry.' + err);
|
||||
});
|
||||
};
|
||||
|
||||
const usuarioInscrito = async (numeroCuenta, idArea) => {
|
||||
const conn = await pool.getConnection().catch((err) => {
|
||||
throw new Error('No se pudo conectar con la db. ' + err);
|
||||
@@ -101,25 +84,6 @@ const agregarDetalleServicio = async (monto, numeroCuenta) => {
|
||||
});
|
||||
};
|
||||
|
||||
const borrarInscripcion = async (numeroCuenta) => {
|
||||
const conn = await pool.getConnection().catch((err) => {
|
||||
throw new Error('No se pudo conectar con la db. ' + err);
|
||||
});
|
||||
|
||||
return conn
|
||||
.query(
|
||||
`DELETE FROM alumno_inscrito WHERE id_cuenta = ${numeroCuenta} AND periodo = 20`
|
||||
)
|
||||
.then((rows) => {
|
||||
conn.end();
|
||||
return rows[0];
|
||||
})
|
||||
.catch((err) => {
|
||||
conn.end();
|
||||
throw new Error('Hubo un problema con el querry.' + err);
|
||||
});
|
||||
};
|
||||
|
||||
const borrarRecibo = async (folio) => {
|
||||
const conn = await pool.getConnection().catch((err) => {
|
||||
throw new Error('No se pudo conectar con la db. ' + err);
|
||||
@@ -158,11 +122,9 @@ const borrarDetalleServicio = async (numeroCuenta) => {
|
||||
|
||||
module.exports = {
|
||||
obtenerDatosUsr,
|
||||
obtenerCarrera,
|
||||
usuarioInscrito,
|
||||
agregarRecibo,
|
||||
agregarDetalleServicio,
|
||||
borrarInscripcion,
|
||||
borrarRecibo,
|
||||
borrarDetalleServicio,
|
||||
};
|
||||
|
||||
@@ -2,7 +2,11 @@ const {
|
||||
validarNumeroEntero,
|
||||
validarNumeroCuenta,
|
||||
} = require('../../helper/validar');
|
||||
const { usuarioInscrito } = require('../../config/mariadb.conf');
|
||||
const {
|
||||
usuarioInscrito,
|
||||
borrarRecibo,
|
||||
borrarDetalleServicio,
|
||||
} = require('../../config/mariadb.conf');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Inscripcion = require(`${dbPath}/Inscripcion`);
|
||||
const gmail = require('../../helper/gmail');
|
||||
@@ -51,9 +55,11 @@ const validarTicket = async (body) => {
|
||||
.then((res) => {
|
||||
email = `${numeroCuenta}@pcpuma.acatlan.unam.mx`;
|
||||
if (body.validacion === 1) {
|
||||
correo = correoInscripcion();
|
||||
usuarioInscrito(numeroCuenta, idArea);
|
||||
correo = correoInscripcion();
|
||||
} else {
|
||||
borrarRecibo(folio);
|
||||
borrarDetalleServicio(numeroCuenta);
|
||||
correo = correoDeclinar();
|
||||
return Inscripcion.update(
|
||||
{ motivo: body.motivo },
|
||||
|
||||
Reference in New Issue
Block a user