permitir cero invitados
This commit is contained in:
@@ -9,8 +9,8 @@ const infoInvitados = async (body) => {
|
||||
const invitados = body.invitados;
|
||||
const numeroInvitados = invitados.length;
|
||||
|
||||
if (!numeroInvitados === 0 || numeroInvitados > 3)
|
||||
throw new Error('El número de invitados no puede ser cero ni mayor que 3.');
|
||||
if (numeroInvitados > 3)
|
||||
throw new Error('El número de invitados no puede ser mayor que 3.');
|
||||
|
||||
const prof = await Profesor.findOne({ where: idProfesor });
|
||||
if(prof.numeroInvitados) throw new Error('A este profesor ya se le han guardado sus invitados.')
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const Invitado = require('../../db/tablas/Invitado');
|
||||
const Profesor = require('../../db/tablas/Profesor')
|
||||
|
||||
const get = () => Invitado.findAll();
|
||||
const get = () => Invitado.findAll({include: [{ model: Profesor }],});
|
||||
|
||||
module.exports = get;
|
||||
Reference in New Issue
Block a user