Skip to content

Commit

Permalink
Merge pull request #64 from wearefuturegov/TOP-173-add-number-of-resu…
Browse files Browse the repository at this point in the history
…lts-filter

TOP-173 add per page limit
  • Loading branch information
apricot13 authored Nov 12, 2024
2 parents dfb377c + 2beaf13 commit 4c30fbb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/controllers/v1/services/routes/get-services.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ module.exports = {
*/
parseRequestParameters: async queryParams => {
const perPage = parseInt(queryParams.per_page) || 50
if (perPage > 200) {
throw new Error("Per page limit is 200")
}

const page = parseInt(queryParams.page) || 1
const proximity = parseInt(queryParams.proximity) || 5 * 1609.34 // miles x 1609.34 = Distance in meters
const keywords = queryParams.keywords
Expand Down Expand Up @@ -396,6 +400,7 @@ module.exports = {
totalElements: count,
first: currentPage === 1,
last: currentPage === totalPages,
perPage: perPage,
interpreted_location,
content: content,
}
Expand Down

0 comments on commit 4c30fbb

Please sign in to comment.