diff options
Diffstat (limited to 'src/server/Controller/User.hs')
-rw-r--r-- | src/server/Controller/User.hs | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/server/Controller/User.hs b/src/server/Controller/User.hs index 95e5fa8..bc99ea5 100644 --- a/src/server/Controller/User.hs +++ b/src/server/Controller/User.hs @@ -1,25 +1,38 @@ +{-# LANGUAGE OverloadedStrings #-} + module Controller.User - ( getUsersAction - , whoAmIAction + ( 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 Model.User +import qualified Model.User as U -getUsersAction :: ActionM () -getUsersAction = +getUsers :: ActionM () +getUsers = Secure.loggedAction (\_ -> do - (liftIO $ map getJsonUser <$> runDb getUsers) >>= json + (liftIO $ map U.getJsonUser <$> runDb U.getUsers) >>= json ) -whoAmIAction :: ActionM () -whoAmIAction = +whoAmI :: ActionM () +whoAmI = Secure.loggedAction (\user -> do - json (getJsonUser user) + json (U.getJsonUser user) + ) + +getIncome :: ActionM () +getIncome = + Secure.loggedAction (\_ -> do + jsonObject [] ) |