Files
citas_recorridos_api/server/controller/PrimerSemestre/asistentes.js
T
Lemuel Marquez 407f292738 gurpo horario
2021-07-23 13:02:58 -05:00

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;