aboutsummaryrefslogtreecommitdiff
path: root/src/client/Model/Payment.elm
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-08-14 10:29:43 +0200
committerJoris Guyonvarch2015-08-14 10:31:01 +0200
commit006d54bf4ac4dd9e05d62d0007759f28740fd77a (patch)
tree77b06a10c5a747777327811bafc91bc1560eea9f /src/client/Model/Payment.elm
parentd25b857d8317d729995d6aa25db7a83fe92a07ef (diff)
downloadbudget-006d54bf4ac4dd9e05d62d0007759f28740fd77a.tar.gz
budget-006d54bf4ac4dd9e05d62d0007759f28740fd77a.tar.bz2
budget-006d54bf4ac4dd9e05d62d0007759f28740fd77a.zip
One payment is clickable and set to orange for the moment
Diffstat (limited to 'src/client/Model/Payment.elm')
-rw-r--r--src/client/Model/Payment.elm10
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