aboutsummaryrefslogtreecommitdiff
path: root/src/server/Main.hs
diff options
context:
space:
mode:
authorJoris2017-03-24 09:21:06 +0000
committerJoris2017-03-24 09:21:06 +0000
commitc0ac16a713c4e53cf6af8e72a6d5f6b8ac5d6456 (patch)
tree8a438430cee7411259fc395d8f3898488e85d750 /src/server/Main.hs
parent293eb8295162bf0a038f488237db9c9d1316c04d (diff)
parentcfca18262c1ff48dcb683ddab7d03cf8e55573ff (diff)
downloadbudget-c0ac16a713c4e53cf6af8e72a6d5f6b8ac5d6456.tar.gz
budget-c0ac16a713c4e53cf6af8e72a6d5f6b8ac5d6456.tar.bz2
budget-c0ac16a713c4e53cf6af8e72a6d5f6b8ac5d6456.zip
Merge branch 'features/categories' into 'master'
Features/categories See merge request !1
Diffstat (limited to 'src/server/Main.hs')
-rw-r--r--src/server/Main.hs25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/server/Main.hs b/src/server/Main.hs
index 2ce8115..b7764c9 100644
--- a/src/server/Main.hs
+++ b/src/server/Main.hs
@@ -8,10 +8,11 @@ import Job.Daemon (runDaemons)
import qualified Data.Text.Lazy as LT
-import Controller.Index
-import Controller.SignIn
-import Controller.Payment as Payment
-import Controller.Income as Income
+import qualified Controller.Index as Index
+import qualified Controller.SignIn as SignIn
+import qualified Controller.Payment as Payment
+import qualified Controller.Income as Income
+import qualified Controller.Category as Category
import Model.Database (runMigrations)
@@ -27,14 +28,14 @@ main = do
get "/" $ do
signInToken <- mbParam "signInToken"
- getIndex conf signInToken
+ Index.get conf signInToken
post "/signIn" $ do
email <- param "email"
- signIn conf email
+ SignIn.signIn conf email
post "/signOut" $
- signOut conf
+ Index.signOut conf
post "/payment" $
jsonData >>= Payment.create
@@ -56,5 +57,15 @@ main = do
incomeId <- param "id"
Income.deleteOwn incomeId
+ post "/category" $
+ jsonData >>= Category.create
+
+ put "/category" $
+ jsonData >>= Category.edit
+
+ delete "/category" $ do
+ categoryId <- param "id"
+ Category.delete categoryId
+
mbParam :: Parsable a => LT.Text -> ActionM (Maybe a)
mbParam key = (Just <$> param key) `rescue` (const . return $ Nothing)