aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Model/Init.elm
blob: 5db038d3e299f3fbd11d2e675aac99b1f5d5899d (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
module Model.Init
  ( Init
  , initDecoder
  ) where

import Json.Decode as Json exposing ((:=))

import Model.Payment exposing (Payments, paymentsDecoder)
import Model.Income exposing (Incomes, incomesDecoder)
import Model.User exposing (Users, UserId, usersDecoder, userIdDecoder)

type alias Init =
  { users : Users
  , me : UserId
  , payments : Payments
  , incomes : Incomes
  }

initDecoder : Json.Decoder Init
initDecoder =
  Json.object4 Init
    ("users" := usersDecoder)
    ("me" := userIdDecoder)
    ("payments" := paymentsDecoder)
    ("incomes" := incomesDecoder)