servicios de un responsable

This commit is contained in:
2020-11-17 13:49:31 -06:00
parent 454a6573c2
commit 381080d8fa
7 changed files with 162 additions and 49 deletions
+4 -2
View File
@@ -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 },
});