aboutsummaryrefslogtreecommitdiff
path: root/src/server/Model/Json
diff options
context:
space:
mode:
authorJoris2016-06-26 12:31:24 +0200
committerJoris2016-06-26 12:31:24 +0200
commit9ec84e3a20c767f6525639f58cd22715e302b88d (patch)
treea080552859180707472c1a289080857c0a54fc06 /src/server/Model/Json
parent5cb36652ccf07c9e0995ebc421a837ad7d258469 (diff)
Add an editable date field for punctual payment creation
Diffstat (limited to 'src/server/Model/Json')
-rw-r--r--src/server/Model/Json/CreateIncome.hs (renamed from src/server/Model/Json/AddIncome.hs)10
-rw-r--r--src/server/Model/Json/CreatePayment.hs22
-rw-r--r--src/server/Model/Json/Income.hs2
-rw-r--r--src/server/Model/Json/Payment.hs4
4 files changed, 30 insertions, 8 deletions
diff --git a/src/server/Model/Json/AddIncome.hs b/src/server/Model/Json/CreateIncome.hs
index 6570ba9..cf9b1c3 100644
--- a/src/server/Model/Json/AddIncome.hs
+++ b/src/server/Model/Json/CreateIncome.hs
@@ -1,7 +1,7 @@
{-# LANGUAGE DeriveGeneric #-}
-module Model.Json.AddIncome
- ( AddIncome(..)
+module Model.Json.CreateIncome
+ ( CreateIncome(..)
) where
import GHC.Generics
@@ -9,9 +9,9 @@ import GHC.Generics
import Data.Aeson
import Data.Time.Calendar (Day)
-data AddIncome = AddIncome
- { day :: Day
+data CreateIncome = CreateIncome
+ { date :: Day
, amount :: Int
} deriving (Show, Generic)
-instance FromJSON AddIncome
+instance FromJSON CreateIncome
diff --git a/src/server/Model/Json/CreatePayment.hs b/src/server/Model/Json/CreatePayment.hs
new file mode 100644
index 0000000..f117daf
--- /dev/null
+++ b/src/server/Model/Json/CreatePayment.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE DeriveGeneric #-}
+
+module Model.Json.CreatePayment
+ ( CreatePayment(..)
+ ) where
+
+import GHC.Generics
+
+import Data.Aeson
+import Data.Time.Calendar (Day)
+import Data.Text (Text)
+
+import Model.Frequency (Frequency)
+
+data CreatePayment = CreatePayment
+ { date :: Day
+ , name :: Text
+ , cost :: Int
+ , frequency :: Frequency
+ } deriving (Show, Generic)
+
+instance FromJSON CreatePayment
diff --git a/src/server/Model/Json/Income.hs b/src/server/Model/Json/Income.hs
index e80ab63..bb1ac97 100644
--- a/src/server/Model/Json/Income.hs
+++ b/src/server/Model/Json/Income.hs
@@ -14,7 +14,7 @@ import Model.Database (IncomeId, UserId)
data Income = Income
{ id :: IncomeId
, userId :: UserId
- , day :: Day
+ , date :: Day
, amount :: Int
} deriving (Show, Generic)
diff --git a/src/server/Model/Json/Payment.hs b/src/server/Model/Json/Payment.hs
index 7f4de15..04c6de8 100644
--- a/src/server/Model/Json/Payment.hs
+++ b/src/server/Model/Json/Payment.hs
@@ -6,16 +6,16 @@ module Model.Json.Payment
import GHC.Generics
-import Data.Time
import Data.Text (Text)
import Data.Aeson
+import Data.Time.Calendar (Day)
import Model.Database (PaymentId, UserId)
import Model.Frequency
data Payment = Payment
{ id :: PaymentId
- , creation :: UTCTime
+ , date :: Day
, name :: Text
, cost :: Int
, userId :: UserId