aboutsummaryrefslogtreecommitdiff
path: root/src/server/Controller
diff options
context:
space:
mode:
authorJoris2015-09-03 23:32:39 +0200
committerJoris2015-09-03 23:32:39 +0200
commit889df8caf04de5f10a9e623bab3e502e9573159d (patch)
treed8c3dff55ffd38914543213e544c55e346e1f13e /src/server/Controller
parentebd304d97b612d0ac4ea276b1c29ba8ecc0b7998 (diff)
Give the payments count to the client
Diffstat (limited to 'src/server/Controller')
-rw-r--r--src/server/Controller/Payment.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/server/Controller/Payment.hs b/src/server/Controller/Payment.hs
index 117310a..dc1083e 100644
--- a/src/server/Controller/Payment.hs
+++ b/src/server/Controller/Payment.hs
@@ -3,6 +3,7 @@ module Controller.Payment
, createPaymentAction
, deletePaymentAction
, getTotalPaymentsAction
+ , getPaymentsCountAction
) where
import Web.Scotty
@@ -20,6 +21,7 @@ import qualified Secure
import Model.Database
import Model.Payment
import Model.Json.Message
+import Model.Json.Number
import Model.Message
import Model.Message.Key (Key(PaymentNotDeleted))
@@ -54,3 +56,9 @@ getTotalPaymentsAction =
Secure.loggedAction (\_ -> do
(liftIO . runDb $ getTotalPayments) >>= json
)
+
+getPaymentsCountAction :: ActionM ()
+getPaymentsCountAction =
+ Secure.loggedAction (\_ -> do
+ Number <$> (liftIO . runDb $ getPaymentsCount) >>= json
+ )