From 21c38acfb388f9141bada4b0e32d07dc580a344f Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 22 Jan 2018 23:16:31 -0800 Subject: Query all records --- main.hs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'main.hs') 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) ] -- cgit v1.2.3