Funciones sql borrar
This commit is contained in:
@@ -101,10 +101,66 @@ 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}`)
|
||||
.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);
|
||||
});
|
||||
|
||||
return conn
|
||||
.query(`DELETE FROM recibo WHERE folio = ${folio}`)
|
||||
.then((rows) => {
|
||||
conn.end();
|
||||
return rows[0];
|
||||
})
|
||||
.catch((err) => {
|
||||
conn.end();
|
||||
throw new Error('Hubo un problema con el querry.' + err);
|
||||
});
|
||||
};
|
||||
|
||||
const borrarDetalleServicio = 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 detalle_servicio WHERE id_Cuenta = ${numeroCuenta} AND id_servicio = 4`
|
||||
)
|
||||
.then((rows) => {
|
||||
conn.end();
|
||||
return rows[0];
|
||||
})
|
||||
.catch((err) => {
|
||||
conn.end();
|
||||
throw new Error('Hubo un problema con el querry.' + err);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
obtenerDatosUsr,
|
||||
obtenerCarrera,
|
||||
usuarioInscrito,
|
||||
agregarRecibo,
|
||||
agregarDetalleServicio,
|
||||
borrarInscripcion,
|
||||
borrarRecibo,
|
||||
borrarDetalleServicio,
|
||||
};
|
||||
|
||||
@@ -13,9 +13,6 @@ const motivo = require(`${controllerPath}/motivo`);
|
||||
const validarSinTicket = require(`${controllerPath}/validarSinTicket`);
|
||||
const validarTicket = require(`${controllerPath}/validarTicket`);
|
||||
const reporte = require(`${controllerPath}/reporte`);
|
||||
const restarCredito = require(`${controllerPath}/restarCredito`);
|
||||
const ticketsImpresion = require(`${controllerPath}/ticketsImpresion`);
|
||||
const credito = require(`${controllerPath}/credito`);
|
||||
|
||||
app.post(`${route}/login`, (req, res) => {
|
||||
return login(req.body)
|
||||
|
||||
@@ -9,8 +9,6 @@ const controllerPath = '../controller/Usuario';
|
||||
const login = require(`${controllerPath}/login`);
|
||||
const inscripciones = require(`${controllerPath}/inscripciones`);
|
||||
const inscripcionUsuario = require(`${controllerPath}/inscripcionUsuario`);
|
||||
const agregarCredito = require(`${controllerPath}/agregarCredito`);
|
||||
const credito = require(`${controllerPath}/credito`);
|
||||
|
||||
app.post(`${route}/login`, (req, res) => {
|
||||
return login(req.body)
|
||||
|
||||
Reference in New Issue
Block a user