From 9ec84e3a20c767f6525639f58cd22715e302b88d Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 26 Jun 2016 12:31:24 +0200 Subject: Add an editable date field for punctual payment creation --- src/server/Main.hs | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'src/server/Main.hs') 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 -- cgit v1.2.3