aboutsummaryrefslogtreecommitdiff
path: root/server/src/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/Controller')
-rw-r--r--server/src/Controller/Income.hs13
1 files changed, 12 insertions, 1 deletions
diff --git a/server/src/Controller/Income.hs b/server/src/Controller/Income.hs
index 236e032..3272cbf 100644
--- a/server/src/Controller/Income.hs
+++ b/server/src/Controller/Income.hs
@@ -1,5 +1,6 @@
module Controller.Income
( list
+ , listv2
, create
, edit
, delete
@@ -12,7 +13,7 @@ import Web.Scotty hiding (delete)
import Common.Model (CreateIncomeForm (..),
EditIncomeForm (..), IncomeId,
- User (..))
+ IncomesAndCount (..), User (..))
import qualified Controller.Helper as ControllerHelper
import Model.CreateIncome (CreateIncome (..))
@@ -28,6 +29,16 @@ list =
(liftIO . Query.run $ IncomePersistence.list) >>= json
)
+listv2 :: Int -> Int -> ActionM ()
+listv2 page perPage =
+ Secure.loggedAction (\_ ->
+ (liftIO . Query.run $ do
+ count <- IncomePersistence.count
+ incomes <- IncomePersistence.listv2 page perPage
+ return $ IncomesAndCount incomes count
+ ) >>= json
+ )
+
create :: CreateIncomeForm -> ActionM ()
create form =
Secure.loggedAction (\user ->