terminada
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@ yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
|
||||
uploads/*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
const Premiacion = require('../../db/tablas/Premiacion');
|
||||
const { validarNumeroEntero } = require('../../helper/validar');
|
||||
|
||||
const getPaginacion = async (query) => {
|
||||
const pagina = validarNumeroEntero(query.pagina, 'página', false);
|
||||
|
||||
return Premiacion.findAndCountAll({
|
||||
limit: 25,
|
||||
offset: 25 * (pagina - 1),
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = getPaginacion;
|
||||
|
||||
@@ -4,12 +4,23 @@ const app = express();
|
||||
const route = '/premiacion';
|
||||
const controllerPath = '../controller/Premiacion';
|
||||
const get = require(`${controllerPath}/premiaciones`);
|
||||
const getPaginacion = require(`${controllerPath}/premiacionesPaginacion`);
|
||||
const editar = require(`${controllerPath}/editar`);
|
||||
const nueva = require(`${controllerPath}/nueva`);
|
||||
const activarDesactivar = require(`${controllerPath}/activarDesactivar`);
|
||||
|
||||
app.get(`${route}/get`, (req, res) => {
|
||||
return get(req.query)
|
||||
return get()
|
||||
.then((data) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
res.status(400).json({ message: err.message });
|
||||
});
|
||||
});
|
||||
|
||||
app.get(`${route}/premiacionesPaginacion`, (req, res) => {
|
||||
return getPaginacion(req.query)
|
||||
.then((data) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user