diff options
author | Joris | 2016-03-27 17:36:33 +0200 |
---|---|---|
committer | Joris | 2016-03-27 17:59:32 +0200 |
commit | 869bab77e93e2a6c776a4b1fc35ef0fd5df22f5f (patch) | |
tree | 917a9e871eff1c487da63ea2407234d7e3829dda /src/server/Controller/User.hs | |
parent | a8882071da12cbb5b0bf2f003322e42e181b0c82 (diff) |
Compute payers client side rather than server side
Diffstat (limited to 'src/server/Controller/User.hs')
-rw-r--r-- | src/server/Controller/User.hs | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/server/Controller/User.hs b/src/server/Controller/User.hs index 420a2d9..1baab18 100644 --- a/src/server/Controller/User.hs +++ b/src/server/Controller/User.hs @@ -3,27 +3,16 @@ module Controller.User ( getUsers , whoAmI - , getIncome - , setIncome ) where import Web.Scotty -import Network.HTTP.Types.Status (ok200) - import Control.Monad.IO.Class (liftIO) -import Database.Persist - -import qualified Data.Aeson.Types as Json - import qualified Secure -import Json (jsonObject) - import Model.Database import qualified Model.User as U -import qualified Model.Income as I getUsers :: ActionM () getUsers = @@ -36,20 +25,3 @@ whoAmI = Secure.loggedAction (\user -> json (U.getJsonUser user) ) - -getIncome :: ActionM () -getIncome = - Secure.loggedAction (\user -> do - mbIncome <- liftIO . runDb . I.getIncome $ entityKey user - case mbIncome of - Just income -> - jsonObject [("income", Json.Number . fromIntegral . incomeAmount $ income)] - Nothing -> - jsonObject [] - ) - -setIncome :: Int -> ActionM () -setIncome amount = - Secure.loggedAction (\user -> - (liftIO . runDb $ I.setIncome (entityKey user) amount) >> status ok200 - ) |