Mensajes y corregí errores en el login

This commit is contained in:
Andres2908
2022-01-30 23:50:17 -06:00
parent 494e7380f3
commit f591727f82
6 changed files with 30 additions and 14 deletions
+4 -4
View File
@@ -8,13 +8,13 @@ const pool = mariadb.createPool({
database: process.env.SAT_DB,
});
const obtenerAlumno = async (numeroCuenta) => {
const obtenerIdCarrera = async (numeroCuenta) => {
const conn = await pool.getConnection().catch((err) => {
throw new Error('No se pudo conectar con la db. ' + err);
});
return conn
.query(`SELECT *FROM alumno WHERE id_cuenta = ${numeroCuenta}`)
.query(`SELECT id_carrera FROM alumno WHERE id_cuenta = ${numeroCuenta}`)
.then((rows) => {
conn.end();
// console.log(rows[0]);
@@ -33,7 +33,7 @@ const obtenerCarrera = async (idCarrera) => {
});
return conn
.query(`SELECT *FROM carrera WHERE id_carrera = ${idCarrera}`)
.query(`SELECT id_carrera FROM carrera WHERE id_carrera = ${idCarrera}`)
.then((rows) => {
conn.end();
return rows[0];
@@ -44,4 +44,4 @@ const obtenerCarrera = async (idCarrera) => {
});
};
module.exports = { obtenerAlumno, obtenerCarrera };
module.exports = { obtenerIdCarrera, obtenerCarrera };