augment default per page limit and parse it as int

This commit is contained in:
Lucy Cifferello
2022-06-17 11:47:15 -06:00
parent bb0488f1dd
commit 4794e6ae16

View File

@@ -5,6 +5,7 @@
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TupleSections #-} {-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeApplications #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} {-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
{-# HLINT ignore "Redundant <$>" #-} {-# HLINT ignore "Redundant <$>" #-}
@@ -335,7 +336,7 @@ getPackageListR = do
PackageListRes <$> mapConcurrently constructPackageListApiRes pkgsWithDependencies PackageListRes <$> mapConcurrently constructPackageListApiRes pkgsWithDependencies
where where
defaults = PackageListDefaults { packageListOrder = DESC defaults = PackageListDefaults { packageListOrder = DESC
, packageListPageLimit = 20 , packageListPageLimit = 100
, packageListPageNumber = 1 , packageListPageNumber = 1
, packageListCategory = Nothing , packageListCategory = Nothing
, packageListQuery = "" , packageListQuery = ""
@@ -377,7 +378,7 @@ getPackageListR = do
let e = InvalidParamsE "get:per-page" pp let e = InvalidParamsE "get:per-page" pp
$logWarn (show e) $logWarn (show e)
sendResponseStatus status400 e sendResponseStatus status400 e
Just l -> pure l Just (l :: Int) -> pure l
getOsVersionQuery :: Handler (Maybe VersionRange) getOsVersionQuery :: Handler (Maybe VersionRange)
getOsVersionQuery = lookupGetParam "eos-version-compat" >>= \case getOsVersionQuery = lookupGetParam "eos-version-compat" >>= \case
Nothing -> pure Nothing Nothing -> pure Nothing