aboutsummaryrefslogtreecommitdiff
path: root/src/server/Model/Json/Init.hs
blob: 5e6d2a24af3b6c3405b8972a900f06864f46e3ca (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
27
28
29
30
31
32
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