tercer semestre get alumno
This commit is contained in:
@@ -4,7 +4,7 @@ const dbPath = '../../db/tablas';
|
||||
const Carrera = require(`${dbPath}/Carrera`);
|
||||
const Grupo = require(`${dbPath}/Grupo`);
|
||||
|
||||
const admin = async (body) => {
|
||||
const get = async (body) => {
|
||||
const idCarrera = validarId(body.idCarrera);
|
||||
|
||||
return Carrera.findOne({ where: { idCarrera } })
|
||||
@@ -19,4 +19,4 @@ const admin = async (body) => {
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = admin;
|
||||
module.exports = get;
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
const { Op } = require('sequelize');
|
||||
const { validarNumeroCuenta } = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Carrera = require(`${dbPath}/Carrera`);
|
||||
const Grupo = require(`${dbPath}/Grupo`);
|
||||
const TercerSemestre = require(`${dbPath}/TercerSemestre`);
|
||||
|
||||
const get = async (body) => {
|
||||
const numeroCuenta = validarNumeroCuenta(body.numeroCuenta);
|
||||
|
||||
return TercerSemestre.findOne({
|
||||
where: { numeroCuenta },
|
||||
include: [{ model: Grupo, include: [{ model: Carrera }] }],
|
||||
}).then((res) => {
|
||||
if (!res) throw new Error('No existe esta alumno.');
|
||||
if (res.deseaAsistir)
|
||||
throw new Error('Ta se registro a este alumno al recorrido.');
|
||||
delete res.dataValues.idGrupo;
|
||||
delete res.dataValues.Grupo.dataValues.idCarrera;
|
||||
return res;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = get;
|
||||
Reference in New Issue
Block a user