cambios en gets
This commit is contained in:
@@ -4,7 +4,6 @@ const dbPath = '../../db/tablas';
|
||||
const Carrera = require(`${dbPath}/Carrera`);
|
||||
const CasoEspecial = require(`${dbPath}/CasoEspecial`);
|
||||
const Status = require(`${dbPath}/Status`);
|
||||
const TipoUsuario = require(`${dbPath}/TipoUsuario`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const serviciosEspeciales = async (body) => {
|
||||
@@ -23,7 +22,6 @@ const serviciosEspeciales = async (body) => {
|
||||
include: [
|
||||
{
|
||||
model: Usuario,
|
||||
include: { model: TipoUsuario },
|
||||
where: {
|
||||
usuario: { [Op.like]: `%${numeroCuenta}%` },
|
||||
nombre: { [Op.like]: `%${nombre}%` },
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
const moment = require('moment');
|
||||
const { Op } = require('sequelize');
|
||||
const validar = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Carrera = require(`${dbPath}/Carrera`);
|
||||
const Servicio = require(`${dbPath}/Servicio`);
|
||||
const Status = require(`${dbPath}/Status`);
|
||||
const TipoUsuario = require(`${dbPath}/TipoUsuario`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const serviciosAdmin = async (body) => {
|
||||
@@ -23,7 +23,6 @@ const serviciosAdmin = async (body) => {
|
||||
include: [
|
||||
{
|
||||
model: Usuario,
|
||||
include: { model: TipoUsuario },
|
||||
where: {
|
||||
usuario: { [Op.like]: `%${numeroCuenta}%` },
|
||||
nombre: { [Op.like]: `%${nombre}%` },
|
||||
@@ -36,10 +35,24 @@ const serviciosAdmin = async (body) => {
|
||||
limit: 25,
|
||||
offset: 25 * (pagina - 1),
|
||||
}).then((res) => {
|
||||
let data = [];
|
||||
|
||||
for (let i = 0; i < res.rows.length; i++) {
|
||||
// delete res.rows[i].dataValues.idUsuario
|
||||
data.push({
|
||||
idServicio: res.rows[i].idServicio,
|
||||
fechaInicio: moment(res.rows[i].fechaInicio).format(),
|
||||
fechaFin: moment(res.rows[i].fechaFin).format(),
|
||||
createdAt: moment(res.rows[i].fechaFin).format(),
|
||||
Usuario: {
|
||||
idUsuario: res.rows[i].Usuario.idUsuario,
|
||||
usuario: res.rows[i].Usuario.usuario,
|
||||
nombre: res.rows[i].Usuario.nombre,
|
||||
},
|
||||
Carrera: res.rows[i].Carrera,
|
||||
Status: res.rows[i].Status,
|
||||
});
|
||||
}
|
||||
return { count: res.count, serviciosAdmin: res.rows };
|
||||
return { count: res.count, serviciosAdmin: data };
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ const Carrera = require(`${dbPath}/Carrera`);
|
||||
const Programa = require(`${dbPath}/Programa`);
|
||||
const Servicio = require(`${dbPath}/Servicio`);
|
||||
const Status = require(`${dbPath}/Status`);
|
||||
const TipoUsuario = require(`${dbPath}/TipoUsuario`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const serviciosResponsable = async (body) => {
|
||||
@@ -33,7 +32,6 @@ const serviciosResponsable = async (body) => {
|
||||
{ model: Programa, where: { idUsuario } },
|
||||
{
|
||||
model: Usuario,
|
||||
include: { model: TipoUsuario },
|
||||
where: {
|
||||
usuario: { [Op.like]: `%${numeroCuenta}%` },
|
||||
nombre: { [Op.like]: `%${nombre}%` },
|
||||
@@ -55,14 +53,12 @@ const serviciosResponsable = async (body) => {
|
||||
idServicio: res.rows[i].idServicio,
|
||||
fechaInicio: moment(res.rows[i].fechaInicio).format(),
|
||||
fechaFin: moment(res.rows[i].fechaFin).format(),
|
||||
createdAt: moment(res.rows[i].createdAt).format(),
|
||||
cartaTermino: res.rows[i].cartaTermino,
|
||||
idCuestionarioPrograma: res.rows[i].idCuestionarioPrograma,
|
||||
Usuario: {
|
||||
idUsuario: res.rows[i].Usuario.idUsuario,
|
||||
usuario: res.rows[i].Usuario.usuario,
|
||||
nombre: res.rows[i].Usuario.nombre,
|
||||
TipoUsuario: res.rows[i].Usuario.TipoUsuario,
|
||||
},
|
||||
Carrera: res.rows[i].Carrera,
|
||||
Status: res.rows[i].Status,
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
const { Op } = require('sequelize');
|
||||
const validar = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
const TipoUsuario = require(`${dbPath}/TipoUsuario`);
|
||||
const Usuario = require('../../db/tablas/Usuario');
|
||||
|
||||
const responsables = async (body) => {
|
||||
const pagina = validar.validarNumero(body.pagina, true);
|
||||
@@ -19,7 +17,6 @@ const responsables = async (body) => {
|
||||
nombre: { [Op.like]: `%${nombre}%` },
|
||||
idTipoUsuario: 2,
|
||||
},
|
||||
include: [{ model: TipoUsuario }],
|
||||
limit: 25,
|
||||
offset: 25 * (pagina - 1),
|
||||
}).then((res) => {
|
||||
|
||||
Reference in New Issue
Block a user