aboutsummaryrefslogtreecommitdiff
path: root/src/server/Model/Json
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/Model/Json')
-rw-r--r--src/server/Model/Json/Init.hs33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/server/Model/Json/Init.hs b/src/server/Model/Json/Init.hs
new file mode 100644
index 0000000..5e6d2a2
--- /dev/null
+++ b/src/server/Model/Json/Init.hs
@@ -0,0 +1,33 @@
+{-# LANGUAGE DeriveGeneric #-}
+
+module Model.Json.Init
+ ( Init(..)
+ , InitResult(..)
+ ) where
+
+import GHC.Generics
+
+import Data.Aeson
+
+import Model.Database (UserId)
+import Model.Json.User (User)
+import Model.Json.Payment (Payment)
+import Model.Json.Income (Income)
+import Model.Message.Key (Key)
+
+data Init = Init
+ { users :: [User]
+ , me :: UserId
+ , payments :: [Payment]
+ , incomes :: [Income]
+ } deriving (Show, Generic)
+
+instance ToJSON Init
+
+data InitResult =
+ InitEmpty
+ | InitSuccess Init
+ | InitError Key
+ deriving (Show, Generic)
+
+instance ToJSON InitResult