Se modifico a donde se hacen las consultas
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
const { buscarProfesorPorNumero } = require('../../config/mariadb.conf');
|
||||
const Inscripcion = require('../../db/tablas/Inscripcion');
|
||||
const { buscarProfesorPorNumero, validarAlumnoInscrito } = require('../../config/mariadb.conf');
|
||||
|
||||
async function buscarProfesor(req, res) {
|
||||
const { numeroTrabajador } = req.params;
|
||||
@@ -15,19 +14,12 @@ async function buscarProfesor(req, res) {
|
||||
}
|
||||
|
||||
// Verificar si existe ya en la tabla de incripcion
|
||||
const existeIncripcion = await Inscripcion.findOne({
|
||||
where: {
|
||||
idUsuario: profesor.idUsuario
|
||||
const existeInscripcion = await validarAlumnoInscrito(profesor.id_cuenta);
|
||||
if (existeInscripcion) {
|
||||
return res.status(409).json({
|
||||
message: 'El usuario ya está inscrito.',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (existeIncripcion) {
|
||||
return res.status(409).json({
|
||||
//yaInscrito: true,
|
||||
message: 'El usuario ya está inscrito.',
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
res.status(200).json(profesor); // { nombre, correo }
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user