diff options
Diffstat (limited to 'src/server/Model/Json')
-rw-r--r-- | src/server/Model/Json/Income.hs | 18 | ||||
-rw-r--r-- | src/server/Model/Json/Payer.hs | 22 | ||||
-rw-r--r-- | src/server/Model/Json/TotalPayment.hs | 19 |
3 files changed, 40 insertions, 19 deletions
diff --git a/src/server/Model/Json/Income.hs b/src/server/Model/Json/Income.hs new file mode 100644 index 0000000..4549ca5 --- /dev/null +++ b/src/server/Model/Json/Income.hs @@ -0,0 +1,18 @@ +{-# LANGUAGE DeriveGeneric #-} + +module Model.Json.Income + ( Income(..) + ) where + +import GHC.Generics + +import Data.Aeson +import Data.Time.Clock (UTCTime) + +data Income = Income + { creation :: UTCTime + , amount :: Int + } deriving (Show, Generic) + +instance FromJSON Income +instance ToJSON Income diff --git a/src/server/Model/Json/Payer.hs b/src/server/Model/Json/Payer.hs new file mode 100644 index 0000000..2101e40 --- /dev/null +++ b/src/server/Model/Json/Payer.hs @@ -0,0 +1,22 @@ +{-# LANGUAGE DeriveGeneric #-} + +module Model.Json.Payer + ( Payer(..) + ) where + +import GHC.Generics + +import Data.Aeson + +import Model.Database (UserId) +import Model.Json.Income + +data Payer = Payer + { userId :: UserId + , preIncomePaymentSum :: Int + , postIncomePaymentSum :: Int + , incomes :: [Income] + } deriving (Show, Generic) + +instance FromJSON Payer +instance ToJSON Payer diff --git a/src/server/Model/Json/TotalPayment.hs b/src/server/Model/Json/TotalPayment.hs deleted file mode 100644 index 2b1cd06..0000000 --- a/src/server/Model/Json/TotalPayment.hs +++ /dev/null @@ -1,19 +0,0 @@ -{-# LANGUAGE DeriveGeneric #-} - -module Model.Json.TotalPayment - ( TotalPayment(..) - ) where - -import GHC.Generics - -import Data.Aeson - -import Model.Database (UserId) - -data TotalPayment = TotalPayment - { userId :: UserId - , totalPayment :: Int - } deriving (Show, Generic) - -instance FromJSON TotalPayment -instance ToJSON TotalPayment |