summaryrefslogtreecommitdiff
path: root/main.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2018-01-22 23:16:31 -0800
committerBen Sima <ben@bsima.me>2018-01-22 23:16:31 -0800
commit21c38acfb388f9141bada4b0e32d07dc580a344f (patch)
tree5cc765c2d1ace67f67366b4b4d902fc265c285e7 /main.hs
parent75c38005222adaf800e19adf2e5669aa5ac323a0 (diff)
Query all records
Diffstat (limited to 'main.hs')
-rwxr-xr-xmain.hs11
1 files changed, 8 insertions, 3 deletions
diff --git a/main.hs b/main.hs
index 6d785c1..59c0b50 100755
--- a/main.hs
+++ b/main.hs
@@ -101,10 +101,15 @@ getQueryR :: Handler RepJson
getQueryR = do
qm <- lookupGetParam "number"
case qm of
- Nothing ->
- sendStatusJSON status400 $ (ApiError "Invalid request. Could not parse 'number' parameter.")
+ Nothing -> do
+ app <- getYesod
+ let db = appState app
+ callers <- liftIO $ query db (ViewCallers 20)
+ sendStatusJSON status400 $ callers
- Just q ->
+ Just q -> do
+ app <- getYesod
+ let db = appState app
sendStatusJSON status200 $ object [ "msg" .= ("FIXME" :: Text) ]