blob: 7e23a8419db9d7c42af168994353d47c03204215 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
{-# LANGUAGE DeriveGeneric #-}
module Model.Json.Income
( Income(..)
, fromIncome
) where
import Data.Aeson
import Data.Time.Calendar (Day)
import GHC.Generics
import Model.Income (IncomeId)
import Model.User (UserId)
import qualified Model.Income as M
data Income = Income
{ id :: IncomeId
, userId :: UserId
, date :: Day
, amount :: Int
} deriving (Show, Generic)
instance ToJSON Income
fromIncome :: M.Income -> Income
fromIncome income = Income (M.id income) (M.userId income) (M.date income) (M.amount income)
|