From c71aa47ca60bfe6409214f807d27e434c58d5d81 Mon Sep 17 00:00:00 2001 From: samparsky <8148384+samparsky@users.noreply.github.com> Date: Thu, 10 Dec 2020 14:06:30 +0200 Subject: [PATCH] fix: page type --- routes/channel.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/routes/channel.js b/routes/channel.js index ceb162ab..ef67b387 100644 --- a/routes/channel.js +++ b/routes/channel.js @@ -65,9 +65,10 @@ function getEventAggregates(req, res, next) { async function getList(req, res, next) { const { CHANNELS_FIND_LIMIT } = cfg // assign 0 default value - const { page = 0, validUntil } = req.query + const { page: paramsPage, validUntil } = req.query const channelsCol = db.getMongo().collection('channels') - const skip = page && parseInt(page, 10) * CHANNELS_FIND_LIMIT + const page = parseInt(paramsPage, 10) || 0 + const skip = page * CHANNELS_FIND_LIMIT let query = { validUntil: { $gt: parseInt(validUntil, 10) || Math.floor(Date.now() / 1000) } }