From a48e79e2f7c1ab1ffb52b86ef9e900c75c5d023b Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 12 Sep 2015 23:57:16 +0200 Subject: Adding UI income read-only --- src/server/Controller/User.hs | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'src/server/Controller/User.hs') 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 [] ) -- cgit v1.2.3