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/Payment.hs6
-rw-r--r--src/server/Model/Json/TotalPayment.hs4
-rw-r--r--src/server/Model/Json/User.hs21
3 files changed, 28 insertions, 3 deletions
diff --git a/src/server/Model/Json/Payment.hs b/src/server/Model/Json/Payment.hs
index f22c8cf..8923c13 100644
--- a/src/server/Model/Json/Payment.hs
+++ b/src/server/Model/Json/Payment.hs
@@ -10,12 +10,14 @@ import Data.Time
import Data.Text (Text)
import Data.Aeson
+import Model.Database (PaymentId, UserId)
+
data Payment = Payment
- { id :: Text
+ { id :: PaymentId
, creation :: UTCTime
, name :: Text
, cost :: Int
- , userName :: Text
+ , userId :: UserId
} deriving (Show, Generic)
instance FromJSON Payment
diff --git a/src/server/Model/Json/TotalPayment.hs b/src/server/Model/Json/TotalPayment.hs
index e386c79..5ae68c9 100644
--- a/src/server/Model/Json/TotalPayment.hs
+++ b/src/server/Model/Json/TotalPayment.hs
@@ -9,8 +9,10 @@ import GHC.Generics
import Data.Text (Text)
import Data.Aeson
+import Model.Database (UserId)
+
data TotalPayment = TotalPayment
- { userName :: Text
+ { userId :: UserId
, totalPayment :: Int
} deriving (Show, Generic)
diff --git a/src/server/Model/Json/User.hs b/src/server/Model/Json/User.hs
new file mode 100644
index 0000000..ebc347b
--- /dev/null
+++ b/src/server/Model/Json/User.hs
@@ -0,0 +1,21 @@
+{-# LANGUAGE DeriveGeneric #-}
+
+module Model.Json.User
+ ( User(..)
+ ) where
+
+import GHC.Generics
+
+import Data.Aeson
+import Data.Text (Text)
+
+import Model.Database (UserId)
+
+data User = User
+ { id :: UserId
+ , name :: Text
+ , email :: Text
+ } deriving (Show, Generic)
+
+instance FromJSON User
+instance ToJSON User