22 lines
709 B
JavaScript
22 lines
709 B
JavaScript
const helperPath = '../../helper';
|
|
const validar = require(`${helperPath}/validar`);
|
|
const dbPath = '../../db/tablas';
|
|
const Carrera = require(`${dbPath}/Carrera`);
|
|
const Grupo = require(`${dbPath}/Grupo`);
|
|
const Horario = require(`${dbPath}/Horario`);
|
|
const PrimerSemestre = require(`${dbPath}/PrimerSemestre`);
|
|
|
|
const asistentes = async (body) => {
|
|
const idHorario = validar.validarId(body.idHorario);
|
|
|
|
return Horario.findOne({ where: { idHorario } }).then((res) => {
|
|
if (!res) throw new Error('No existe este horario.');
|
|
return PrimerSemestre.findAll({
|
|
where: { idHorario },
|
|
include: [{ model: Grupo, include: [{ model: Carrera }] }],
|
|
});
|
|
});
|
|
};
|
|
|
|
module.exports = asistentes;
|