filtrado
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
const { Op } = require('sequelize');
|
||||
const validar = require('../../helper/validar');
|
||||
const Programa = require('../../db/tablas/Programa');
|
||||
const Usuario = require('../../db/tablas/Usuario');
|
||||
@@ -7,12 +6,12 @@ const get = async (body) => {
|
||||
let idUsuario = validar.validarId(body.idUsuario);
|
||||
|
||||
return Usuario.findOne({
|
||||
where: { [Op.and]: [{ idUsuario }, { idTipoUsuario: 2 }] },
|
||||
where: { idUsuario, idTipoUsuario: 2 },
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('Id de responsable no valido');
|
||||
return Programa.findAll({
|
||||
where: { [Op.and]: [{ idUsuario }, { activo: true }] },
|
||||
where: { idUsuario, activo: true },
|
||||
});
|
||||
})
|
||||
.then((res) => {
|
||||
|
||||
Reference in New Issue
Block a user