aboutsummaryrefslogtreecommitdiff
path: root/src/server/Model/Json
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-08-11 21:32:10 +0200
committerJoris Guyonvarch2015-08-11 21:32:10 +0200
commit892a7dd19a92fc18767984e624b8a5026dce61e4 (patch)
tree7d59d58d96958e91a4e9114be0effb9ec7a082a8 /src/server/Model/Json
parenta3bab4f2a0cc8a6a95753dc91d8e862f40c80dcc (diff)
Showing server sides generated messages from the client
Diffstat (limited to 'src/server/Model/Json')
-rw-r--r--src/server/Model/Json/MessagePart.hs18
-rw-r--r--src/server/Model/Json/Translation.hs4
2 files changed, 21 insertions, 1 deletions
diff --git a/src/server/Model/Json/MessagePart.hs b/src/server/Model/Json/MessagePart.hs
new file mode 100644
index 0000000..0753d7c
--- /dev/null
+++ b/src/server/Model/Json/MessagePart.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE DeriveGeneric #-}
+
+module Model.Json.MessagePart
+ ( MessagePart(..)
+ ) where
+
+import Data.Text (Text)
+
+import Data.Aeson
+import GHC.Generics
+
+data MessagePart =
+ Order Int
+ | Str Text
+ deriving (Eq, Show, Generic)
+
+instance FromJSON MessagePart
+instance ToJSON MessagePart
diff --git a/src/server/Model/Json/Translation.hs b/src/server/Model/Json/Translation.hs
index 7291157..9dcfe80 100644
--- a/src/server/Model/Json/Translation.hs
+++ b/src/server/Model/Json/Translation.hs
@@ -9,9 +9,11 @@ import GHC.Generics
import Data.Aeson
import Data.Text
+import Model.Json.MessagePart
+
data Translation = Translation
{ key :: Text
- , message :: Text
+ , message :: [MessagePart]
} deriving (Show, Generic)
instance FromJSON Translation