traer servicios sociales de back para el admin
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
const Servicio = require('../../db/tablas/Servicio');
|
||||
|
||||
const serviciosAdmin = (body) => {
|
||||
Servicio.findAll().then((res) => {
|
||||
return res;
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
const validar = require('../../helper/validar');
|
||||
const Servicio = require('../../db/tablas/Servicio');
|
||||
const Usuario = require('../../db/tablas/Usuario');
|
||||
|
||||
const serviciosAdmin = async (body) => {
|
||||
let pagina = body.pagina;
|
||||
let nombre = body.nombre;
|
||||
let numeroCuenta = body.numeroCuenta;
|
||||
let idStatus = body.idStatus;
|
||||
|
||||
return Servicio.findAll({ include: { model: Usuario } }).then((res) => {
|
||||
let data = [];
|
||||
|
||||
for (let i = pagina * 25 - 25; i < res.length && i < pagina * 25; i++)
|
||||
data.push(res[i]);
|
||||
return {
|
||||
registros: res.length,
|
||||
faltantes: res.length - data.length - (pagina - 1) * 25,
|
||||
servicios: data,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = serviciosAdmin;
|
||||
Reference in New Issue
Block a user