aboutsummaryrefslogtreecommitdiff
path: root/server/src/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/Controller')
-rw-r--r--server/src/Controller/Category.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/server/src/Controller/Category.hs b/server/src/Controller/Category.hs
index 36ce3fc..371ba78 100644
--- a/server/src/Controller/Category.hs
+++ b/server/src/Controller/Category.hs
@@ -22,6 +22,7 @@ import Model.CreateCategory (CreateCategory (..))
import Model.EditCategory (EditCategory (..))
import qualified Model.Query as Query
import qualified Persistence.Category as CategoryPersistence
+import qualified Persistence.Payment as PaymentPersistence
import qualified Secure
import qualified Validation.Category as CategoryValidation
@@ -36,8 +37,9 @@ list page perPage =
Secure.loggedAction (\_ ->
(liftIO . Query.run $ do
categories <- CategoryPersistence.list page perPage
+ usedCategories <- PaymentPersistence.usedCategories
count <- CategoryPersistence.count
- return $ CategoryPage page categories count
+ return $ CategoryPage page categories usedCategories count
) >>= json
)
@@ -76,7 +78,6 @@ delete :: CategoryId -> ActionM ()
delete categoryId =
Secure.loggedAction (\_ -> do
deleted <- liftIO . Query.run $ do
- -- TODO: delete only if no payment has this category
CategoryPersistence.delete categoryId
if deleted
then