aboutsummaryrefslogtreecommitdiff
path: root/src/server/Main.hs
diff options
context:
space:
mode:
authorJoris2016-06-26 12:31:24 +0200
committerJoris2016-06-26 12:31:24 +0200
commit9ec84e3a20c767f6525639f58cd22715e302b88d (patch)
treea080552859180707472c1a289080857c0a54fc06 /src/server/Main.hs
parent5cb36652ccf07c9e0995ebc421a837ad7d258469 (diff)
downloadbudget-9ec84e3a20c767f6525639f58cd22715e302b88d.tar.gz
budget-9ec84e3a20c767f6525639f58cd22715e302b88d.tar.bz2
budget-9ec84e3a20c767f6525639f58cd22715e302b88d.zip
Add an editable date field for punctual payment creation
Diffstat (limited to 'src/server/Main.hs')
-rw-r--r--src/server/Main.hs30
1 files changed, 7 insertions, 23 deletions
diff --git a/src/server/Main.hs b/src/server/Main.hs
index d04a3ac..72e8675 100644
--- a/src/server/Main.hs
+++ b/src/server/Main.hs
@@ -14,12 +14,10 @@ import qualified Data.Text.IO as T
import Controller.Index
import Controller.SignIn
-import Controller.Payment
-import Controller.User
+import Controller.Payment as Payment
import Controller.Income
import Model.Database (runMigrations)
-import Model.Frequency
import qualified Conf
@@ -52,32 +50,18 @@ main = do
post "/signOut" (signOut conf)
- -- Users
+ -- Payments
- get "/users" getUsers
+ post "/payment" $ jsonData >>= Payment.create
- get "/whoAmI" whoAmI
+ delete "/payment" $ do
+ paymentId <- param "id" :: ActionM Text
+ Payment.deleteOwn paymentId
-- Incomes
- get "/incomes" getIncomes
-
- post "/income" $ jsonData >>= addIncome
+ post "/income" $ jsonData >>= createIncome
delete "/income" $ do
incomeId <- param "id" :: ActionM Text
deleteOwnIncome incomeId
-
- -- Payments
-
- get "/payments" getPayments
-
- post "/payment/add" $ do
- name <- param "name" :: ActionM Text
- cost <- param "cost" :: ActionM Int
- frequency <- param "frequency" :: ActionM Frequency
- createPayment name cost frequency
-
- delete "/payment" $ do
- paymentId <- param "id" :: ActionM Text
- deleteOwnPayment paymentId