2022-04-12 10:55:02 -05:00
|
|
|
const Invitado = require('../../db/tablas/Invitado');
|
2022-05-13 22:10:54 -05:00
|
|
|
const Profesor = require('../../db/tablas/Profesor');
|
|
|
|
|
const { validarNumeroEntero } = require('../../helper/validar');
|
2022-04-12 10:55:02 -05:00
|
|
|
|
2022-05-13 22:10:54 -05:00
|
|
|
const get = async (query) => {
|
|
|
|
|
const idPremiacion = validarNumeroEntero(
|
|
|
|
|
query.idPremiacion,
|
|
|
|
|
'idPremiacion',
|
|
|
|
|
true
|
|
|
|
|
);
|
2022-04-12 10:55:02 -05:00
|
|
|
|
2022-05-13 22:10:54 -05:00
|
|
|
const invitados = await Invitado.findAll({
|
|
|
|
|
where: { idPremiacion },
|
|
|
|
|
include: [{ model: Profesor }],
|
|
|
|
|
});
|
|
|
|
|
if (!invitados) throw new Error('No se ha podido traer a los invitados');
|
|
|
|
|
return invitados;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.exports = get;
|