diff options
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 () |