aboutsummaryrefslogtreecommitdiff
path: root/common/src/Common/Model/Stats.hs
blob: 86e6ab9fe03efbed05d9d7557bfcdff1b4f357e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module Common.Model.Stats
  ( Stats
  , MonthStats(..)
  ) where

import           Data.Aeson            (FromJSON, ToJSON)
import           Data.Map              (Map)
import           Data.Time.Calendar    (Day)
import           GHC.Generics          (Generic)

import           Common.Model.Category (CategoryId)
import           Common.Model.User     (UserId)

type Stats = [MonthStats]

data MonthStats = MonthStats
  { _monthStats_start              :: Day
  , _monthStats_paymentsByCategory :: Map CategoryId Int
  , _monthStats_incomeByUser       :: Map UserId Int
  } deriving (Eq, Show, Generic)

instance FromJSON MonthStats
instance ToJSON MonthStats