correcciones y nueva base

This commit is contained in:
2022-05-13 17:23:10 -05:00
parent 71dce1f4fe
commit f9fa0ac0ca
5 changed files with 67 additions and 12 deletions
+12 -4
View File
@@ -1,8 +1,16 @@
const Carrito = require('../../db/tablas/Profesor');
const Profesor = require('../../db/tablas/Profesor');
const equipos = async () => {
return Carrito.findAll({
const adscripciones = async () => {
return Profesor.findAll({
attributes: ['adscripcion'],
}).then((res) => {
const result = [];
res.forEach((item) => {
if (!result.includes(item.adscripcion)) {
result.push(item.adscripcion);
}
});
return result
});
};
module.exports = equipos;
module.exports = adscripciones;
@@ -6,6 +6,7 @@ const entradaInvitado = async (body) => {
const profesor = await Profesor.findOne({ where: idProfesor });
if (!profesor) throw new Error('Este profesor no existe');
if (!profesor.noInvitados) throw new Error('Este profesor no registró a ninún invitado.')
let noInvDentro = profesor.dataValues.numeroInvitadosDentro;
let noInv = profesor.dataValues.numeroInvitados;
if (noInvDentro && noInvDentro >= noInv)