20 lines
537 B
JavaScript
20 lines
537 B
JavaScript
const { validarNumeroCuenta } = require('../../helper/validar');
|
|
const dbPath = '../../db/tablas';
|
|
const Carrera = require(`${dbPath}/Carrera`);
|
|
const Alumno = require(`${dbPath}/Alumno`);
|
|
|
|
const get = async (body) => {
|
|
const numeroCuenta = validarNumeroCuenta(body.numeroCuenta);
|
|
|
|
return Alumno.findOne({
|
|
where: { numeroCuenta },
|
|
include: [{ model: Carrera }],
|
|
}).then((res) => {
|
|
if (!res) throw new Error('No existe este número de cuenta.');
|
|
delete res.idCarrera;
|
|
return res;
|
|
});
|
|
};
|
|
|
|
module.exports = get;
|