endpoinst obtener usuario y usuarios
This commit is contained in:
@@ -14,6 +14,7 @@ const get = async (body) => {
|
||||
delete res.dataValues.password;
|
||||
delete res.dataValues.idTipoUsuario;
|
||||
delete res.dataValues.idCarrera;
|
||||
if (!res.Carrera) delete res.dataValues.Carrera;
|
||||
return res;
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
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) => {
|
||||
return Usuario.findAll({
|
||||
include: [{ model: TipoUsuario }, { model: Carrera }],
|
||||
}).then((res) => {
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
delete res[i].dataValues.password;
|
||||
delete res[i].dataValues.idTipoUsuario;
|
||||
delete res[i].dataValues.idCarrera;
|
||||
if (!res[i].Carrera) delete res[i].dataValues.Carrera;
|
||||
}
|
||||
return res;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = get;
|
||||
Reference in New Issue
Block a user