tabla casos especiales db

This commit is contained in:
2021-02-10 01:11:11 -06:00
parent 0873e99316
commit 1ef5cc8a07
9 changed files with 148 additions and 27 deletions
+2 -3
View File
@@ -10,7 +10,7 @@ const serviciosAdmin = async (body) => {
const pagina = validar.validarId(body.pagina);
const where = body.idStatus
? { idStatus: validar.validarId(body.idStatus) }
: {};
: { idStatus: { [Op.lte]: 10 } };
const nombre = body.nombre
? validar.validarTexto(body.nombre, 'El nombre', 60)
: '';
@@ -20,7 +20,6 @@ const serviciosAdmin = async (body) => {
const data = [];
return Servicio.findAll({
where,
include: [
{
model: Usuario,
@@ -31,7 +30,7 @@ const serviciosAdmin = async (body) => {
},
},
{ model: Carrera },
{ model: Status },
{ model: Status, where },
],
order: [['updatedAt', 'DESC']],
}).then((res) => {
@@ -12,7 +12,7 @@ const serviciosResponsable = async (body) => {
const idUsuario = validar.validarId(body.idUsuario);
const where = body.idStatus
? { idStatus: validar.validarId(body.idStatus) }
: {};
: { idStatus: { [Op.lt]: 10 } };
const nombre = body.nombre
? validar.validarTexto(body.nombre, 'El nombre', 60)
@@ -28,7 +28,6 @@ const serviciosResponsable = async (body) => {
if (res.idTipoUsuario !== 2)
throw new Error('No es un usuario tipo responsable.');
return Servicio.findAll({
where,
include: [
{ model: Programa, where: { idUsuario } },
{
@@ -40,7 +39,7 @@ const serviciosResponsable = async (body) => {
},
},
{ model: Carrera },
{ model: Status, where: { idStatus: { [Op.not]: 10 } } },
{ model: Status, where },
],
order: [['updatedAt', 'DESC']],
});