diff options
author | Joris | 2015-09-05 13:53:36 +0200 |
---|---|---|
committer | Joris | 2015-09-05 13:53:36 +0200 |
commit | 3b738e0d4cc65f314da7389d4542ec826ba0f454 (patch) | |
tree | ee99236117ad698974c5a6e40ab170f617cb06f3 /src/server/Model/Json | |
parent | 139d4a103a6a48880e5f12a796033956f223563c (diff) |
Using UserId instead of UserName to indentify users
Diffstat (limited to 'src/server/Model/Json')
-rw-r--r-- | src/server/Model/Json/Payment.hs | 6 | ||||
-rw-r--r-- | src/server/Model/Json/TotalPayment.hs | 4 | ||||
-rw-r--r-- | src/server/Model/Json/User.hs | 21 |
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 |