aboutsummaryrefslogtreecommitdiff
path: root/common/src/Common/Model/Stats.hs
diff options
context:
space:
mode:
authorJoris2020-01-27 22:07:18 +0100
committerJoris2020-01-27 22:07:18 +0100
commit79e1d8b0099d61b580a499311f1714b1b7eb07b5 (patch)
treea4c35442914b3a59119ddfc1e6c2ce358ecd4758 /common/src/Common/Model/Stats.hs
parent47c2a4d6b68c54eed5f7b45671b1ccaf8c0db200 (diff)
downloadbudget-79e1d8b0099d61b580a499311f1714b1b7eb07b5.tar.gz
budget-79e1d8b0099d61b580a499311f1714b1b7eb07b5.tar.bz2
budget-79e1d8b0099d61b580a499311f1714b1b7eb07b5.zip
Show total incom by month in statistics
Diffstat (limited to 'common/src/Common/Model/Stats.hs')
-rw-r--r--common/src/Common/Model/Stats.hs23
1 files changed, 23 insertions, 0 deletions
diff --git a/common/src/Common/Model/Stats.hs b/common/src/Common/Model/Stats.hs
new file mode 100644
index 0000000..86e6ab9
--- /dev/null
+++ b/common/src/Common/Model/Stats.hs
@@ -0,0 +1,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