diff options
author | Joris | 2015-12-29 22:38:42 +0100 |
---|---|---|
committer | Joris | 2015-12-29 22:38:42 +0100 |
commit | a7db22556b91bc7c499e010b4c051f4442ad8ce2 (patch) | |
tree | 9f991523cee681bf179c191260b95672f1c44def /src/client/elm/Model/Payment.elm | |
parent | c79fa3e212e8bb49f950da3c3218e32e3b9df2ec (diff) |
Using persona to validate emails
Diffstat (limited to 'src/client/elm/Model/Payment.elm')
-rw-r--r-- | src/client/elm/Model/Payment.elm | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/client/elm/Model/Payment.elm b/src/client/elm/Model/Payment.elm new file mode 100644 index 0000000..c4a8963 --- /dev/null +++ b/src/client/elm/Model/Payment.elm @@ -0,0 +1,44 @@ +module Model.Payment + ( perPage + , Payments + , Payment + , PaymentId + , paymentsDecoder + , paymentIdDecoder + ) where + +import Date exposing (..) +import Json.Decode as Json exposing ((:=)) + +import Model.User exposing (UserId, userIdDecoder) +import Model.Date exposing (dateDecoder) + +perPage : Int +perPage = 8 + +type alias Payments = List Payment + +type alias Payment = + { id : PaymentId + , creation : Date + , name : String + , cost : Int + , userId : UserId + } + +type alias PaymentId = Int + +paymentsDecoder : Json.Decoder Payments +paymentsDecoder = Json.list paymentDecoder + +paymentDecoder : Json.Decoder Payment +paymentDecoder = + Json.object5 Payment + ("id" := paymentIdDecoder) + ("creation" := dateDecoder) + ("name" := Json.string) + ("cost" := Json.int) + ("userId" := userIdDecoder) + +paymentIdDecoder : Json.Decoder PaymentId +paymentIdDecoder = Json.int |