aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Model/Init.elm
blob: 3a86dbad370f8abe62152fb9bfdb43b33eb2a1d9 (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 exposing
  ( Init
  , initDecoder
  )

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)