{-# LANGUAGE OverloadedStrings #-} module Controller.User ( getUsers , whoAmI , getIncome ) where import Web.Scotty import Control.Monad.IO.Class (liftIO) import qualified Data.Aeson.Types as Json import qualified Secure import Json (jsonObject) import Model.Database import qualified Model.User as U getUsers :: ActionM () getUsers = Secure.loggedAction (\_ -> do (liftIO $ map U.getJsonUser <$> runDb U.getUsers) >>= json ) whoAmI :: ActionM () whoAmI = Secure.loggedAction (\user -> do json (U.getJsonUser user) ) getIncome :: ActionM () getIncome = Secure.loggedAction (\_ -> do jsonObject [] )