diff options
author | Joris | 2015-09-12 23:57:16 +0200 |
---|---|---|
committer | Joris | 2015-09-12 23:57:16 +0200 |
commit | a48e79e2f7c1ab1ffb52b86ef9e900c75c5d023b (patch) | |
tree | 05a613aef2d338f10bcdd394e520450656ed8f1c /src/server/Controller/User.hs | |
parent | d87dbd1360c14df83552fd757438c23e5d7b9f9c (diff) |
Adding UI income read-only
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 [] ) |