aboutsummaryrefslogtreecommitdiff
path: root/src/server/Controller
diff options
context:
space:
mode:
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
+ )