aboutsummaryrefslogtreecommitdiff
path: root/src/server/Model/Json/Init.hs
blob: b9f7f40665c032d18fc44c0be76c0150bbbe1235 (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
34
35
36
37
{-# 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.Json.Category (Category)
import Model.Json.PaymentCategory (PaymentCategory)
import Model.Message.Key (Key)

data Init = Init
  { users :: [User]
  , me :: UserId
  , payments :: [Payment]
  , incomes :: [Income]
  , categories :: [Category]
  , paymentCategories :: [PaymentCategory]
  } deriving (Show, Generic)

instance ToJSON Init

data InitResult =
  InitEmpty
  | InitSuccess Init
  | InitError Key
  deriving (Show, Generic)

instance ToJSON InitResult