aboutsummaryrefslogtreecommitdiff
path: root/src/server/Model/Json
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/Model/Json')
-rw-r--r--src/server/Model/Json/CreatePayment.hs4
-rw-r--r--src/server/Model/Json/EditPayment.hs24
2 files changed, 26 insertions, 2 deletions
diff --git a/src/server/Model/Json/CreatePayment.hs b/src/server/Model/Json/CreatePayment.hs
index f117daf..4ba9e1a 100644
--- a/src/server/Model/Json/CreatePayment.hs
+++ b/src/server/Model/Json/CreatePayment.hs
@@ -13,9 +13,9 @@ import Data.Text (Text)
import Model.Frequency (Frequency)
data CreatePayment = CreatePayment
- { date :: Day
- , name :: Text
+ { name :: Text
, cost :: Int
+ , date :: Day
, frequency :: Frequency
} deriving (Show, Generic)
diff --git a/src/server/Model/Json/EditPayment.hs b/src/server/Model/Json/EditPayment.hs
new file mode 100644
index 0000000..4e91000
--- /dev/null
+++ b/src/server/Model/Json/EditPayment.hs
@@ -0,0 +1,24 @@
+{-# LANGUAGE DeriveGeneric #-}
+
+module Model.Json.EditPayment
+ ( EditPayment(..)
+ ) where
+
+import GHC.Generics
+
+import Data.Aeson
+import Data.Time.Calendar (Day)
+import Data.Text (Text)
+
+import Model.Frequency (Frequency)
+import Model.Database (PaymentId)
+
+data EditPayment = EditPayment
+ { id :: PaymentId
+ , name :: Text
+ , cost :: Int
+ , date :: Day
+ , frequency :: Frequency
+ } deriving (Show, Generic)
+
+instance FromJSON EditPayment