servicios de un responsable
This commit is contained in:
@@ -6,10 +6,12 @@ const get = async (body) => {
|
||||
let idUsuario = validar.validarId(body.idUsuario);
|
||||
|
||||
return Usuario.findOne({
|
||||
where: { idUsuario, idTipoUsuario: 2 },
|
||||
where: { idUsuario },
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('Id de responsable no valido');
|
||||
if (!res) throw new Error('No existe este usuario.');
|
||||
if (res.idTipoUsuario != 2)
|
||||
throw new Error('No es un usuario de tipo responsable');
|
||||
return Programa.findAll({
|
||||
where: { idUsuario, activo: true },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user