diff options
Diffstat (limited to 'src/client/Model/Payment.elm')
-rw-r--r-- | src/client/Model/Payment.elm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/client/Model/Payment.elm b/src/client/Model/Payment.elm index ff8f157..fa59943 100644 --- a/src/client/Model/Payment.elm +++ b/src/client/Model/Payment.elm @@ -1,6 +1,7 @@ module Model.Payment ( Payments , Payment + , PaymentId , paymentsDecoder ) where @@ -10,24 +11,29 @@ import Json.Decode as Json exposing ((:=)) type alias Payments = List Payment type alias Payment = - { id : String + { id : PaymentId , creation : Date , name : String , cost : Int , userName : String } +type alias PaymentId = String + paymentsDecoder : Json.Decoder Payments paymentsDecoder = Json.list paymentDecoder paymentDecoder : Json.Decoder Payment paymentDecoder = Json.object5 Payment - ("id" := Json.string) + ("id" := paymentIdDecoder) ("creation" := dateDecoder) ("name" := Json.string) ("cost" := Json.int) ("userName" := Json.string) +paymentIdDecoder : Json.Decoder PaymentId +paymentIdDecoder = Json.string + dateDecoder : Json.Decoder Date dateDecoder = Json.customDecoder Json.string Date.fromString |