22 lines
657 B
JavaScript
22 lines
657 B
JavaScript
const validar = require('../../helper/validar');
|
|
const Usuario = require('../../db/tablas/Usuario');
|
|
const Carrera = require('../../db/tablas/Carrera');
|
|
const TipoUsuario = require('../../db/tablas/TipoUsuario');
|
|
|
|
const get = async (body) => {
|
|
const usuario = validar.validarNumeroCuenta(body.usuario);
|
|
|
|
return Usuario.findOne({
|
|
where: { usuario },
|
|
include: [{ model: TipoUsuario }, { model: Carrera }],
|
|
}).then((res) => {
|
|
if (!res) throw new Error('No existe este usuario.');
|
|
delete res.dataValues.password;
|
|
delete res.dataValues.idTipoUsuario;
|
|
delete res.dataValues.idCarrera;
|
|
return res;
|
|
});
|
|
};
|
|
|
|
module.exports = get;
|