diff options
Diffstat (limited to 'src/server/Main.hs')
-rw-r--r-- | src/server/Main.hs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/server/Main.hs b/src/server/Main.hs index c6e930a..0642288 100644 --- a/src/server/Main.hs +++ b/src/server/Main.hs @@ -11,6 +11,7 @@ import MonthlyPaymentJob (monthlyPaymentJobListener) import Data.Text (Text) import qualified Data.Text.IO as T +import Data.Time.Clock.POSIX (posixSecondsToUTCTime) import Controller.Index import Controller.SignIn @@ -62,14 +63,21 @@ api conf = do -- Users get "/api/users" getUsers + get "/api/whoAmI" whoAmI -- Incomes get "/api/incomes" getIncomes + post "/api/income" $ do + creation <- param "creation" :: ActionM Int amount <- param "amount" :: ActionM Int - setIncome amount + addIncome (posixSecondsToUTCTime $ (fromIntegral creation) / 1000) amount + + delete "/api/income/delete" $ do + incomeId <- param "id" :: ActionM Text + deleteOwnIncome incomeId -- Payments @@ -83,4 +91,4 @@ api conf = do post "/api/payment/delete" $ do paymentId <- param "id" :: ActionM Text - deletePayment paymentId + deleteOwnPayment paymentId |