diff options
author | Joris Guyonvarch | 2015-08-09 00:21:03 +0200 |
---|---|---|
committer | Joris Guyonvarch | 2015-08-09 00:21:03 +0200 |
commit | 169d52bfbe8b7f95dcece3cef245cdd62336e2f8 (patch) | |
tree | 491b5edb2646b41d36920f1c670cba26a674868c /src/server/Controller/Payment.hs | |
parent | a4f60df0f3b72553380bdd3ca960abf42048ed7e (diff) | |
download | budget-169d52bfbe8b7f95dcece3cef245cdd62336e2f8.tar.gz budget-169d52bfbe8b7f95dcece3cef245cdd62336e2f8.tar.bz2 budget-169d52bfbe8b7f95dcece3cef245cdd62336e2f8.zip |
Wording for sign in email
Diffstat (limited to 'src/server/Controller/Payment.hs')
-rw-r--r-- | src/server/Controller/Payment.hs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/server/Controller/Payment.hs b/src/server/Controller/Payment.hs new file mode 100644 index 0000000..1287825 --- /dev/null +++ b/src/server/Controller/Payment.hs @@ -0,0 +1,31 @@ +module Controller.Payment + ( getPaymentsAction + , createPaymentAction + ) where + +import Web.Scotty + +import Database.Persist + +import Control.Monad.IO.Class (liftIO) + +import Data.Text (Text) + +import qualified Secure + +import Model.Database +import Model.Payment + +getPaymentsAction :: ActionM () +getPaymentsAction = + Secure.loggedAction (\_ -> do + payments <- liftIO $ runDb getPayments + json payments + ) + +createPaymentAction :: Text -> Int -> ActionM () +createPaymentAction name cost = + Secure.loggedAction (\user -> do + _ <- liftIO . runDb $ createPayment (entityKey user) name cost + return () + ) |