diff options
author | Joris | 2016-06-12 23:54:17 +0200 |
---|---|---|
committer | Joris | 2016-06-12 23:54:17 +0200 |
commit | 6a0c5087f716ed6c876a666db6573491bfd3e094 (patch) | |
tree | bf439109143c7a1749c2661fc8b805b83a993027 /src/server/Controller | |
parent | 38896af4281d2e191cbde15836a23e4c0274fff6 (diff) |
Design income form
Diffstat (limited to 'src/server/Controller')
-rw-r--r-- | src/server/Controller/Income.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/server/Controller/Income.hs b/src/server/Controller/Income.hs index 4474d51..70e40ce 100644 --- a/src/server/Controller/Income.hs +++ b/src/server/Controller/Income.hs @@ -16,7 +16,6 @@ import Database.Persist import Data.Text (Text) import qualified Data.Text.Lazy as TL -import Data.Time.Clock (UTCTime) import qualified Secure @@ -25,6 +24,7 @@ import Json (jsonId) import Model.Database import qualified Model.Income as Income import qualified Model.Message.Key as Key +import qualified Model.Json.AddIncome as Json getIncomes :: ActionM () getIncomes = @@ -32,10 +32,10 @@ getIncomes = (liftIO $ map Income.getJsonIncome <$> runDb Income.getIncomes) >>= json ) -addIncome :: UTCTime -> Int -> ActionM () -addIncome creation amount = +addIncome :: Json.AddIncome -> ActionM () +addIncome (Json.AddIncome date amount) = Secure.loggedAction (\user -> - (liftIO . runDb $ Income.addIncome (entityKey user) creation amount) >>= jsonId + (liftIO . runDb $ Income.addIncome (entityKey user) date amount) >>= jsonId ) deleteOwnIncome :: Text -> ActionM () |