correcciones y nueva base
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user