Skip to content

Commit

Permalink
Merge pull request #333 from samparsky/fix-page-param
Browse files Browse the repository at this point in the history
fix: page type
  • Loading branch information
Ivo Georgiev authored Dec 10, 2020
2 parents 73c532d + c71aa47 commit 99e72de
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions routes/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}
Expand Down

0 comments on commit 99e72de

Please # to comment.