aboutsummaryrefslogtreecommitdiff
path: root/src/client/Model
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
parentd25b857d8317d729995d6aa25db7a83fe92a07ef (diff)
One payment is clickable and set to orange for the moment
Diffstat (limited to 'src/client/Model')
-rw-r--r--src/client/Model/Payment.elm10
-rw-r--r--src/client/Model/View/Payment/Edition.elm4
2 files changed, 11 insertions, 3 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
diff --git a/src/client/Model/View/Payment/Edition.elm b/src/client/Model/View/Payment/Edition.elm
index a650fa8..f58ce43 100644
--- a/src/client/Model/View/Payment/Edition.elm
+++ b/src/client/Model/View/Payment/Edition.elm
@@ -2,4 +2,6 @@ module Model.View.Payment.Edition
( Edition
) where
-type alias Edition = String
+import Model.Payment exposing (PaymentId)
+
+type alias Edition = PaymentId