aboutsummaryrefslogtreecommitdiff
path: root/src/Model/Json
diff options
context:
space:
mode:
authorJoris2015-09-02 18:42:19 +0200
committerJoris2015-09-02 18:42:19 +0200
commit18c793df31969024213d18624323dd74c3be542d (patch)
treefbe15266596b057a624559d6b3124c7f8e6c012c /src/Model/Json
parent02102713eae95fd6f42ff7681a640e43c5ba6d3d (diff)
Adding output in order to know if the application get the correct material
Diffstat (limited to 'src/Model/Json')
-rw-r--r--src/Model/Json/Search.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Model/Json/Search.hs b/src/Model/Json/Search.hs
index b31b548..74f0ec9 100644
--- a/src/Model/Json/Search.hs
+++ b/src/Model/Json/Search.hs
@@ -2,7 +2,7 @@
module Model.Json.Search
( Search(..)
- , getMaterialIdentifier
+ , getMaterialSearch
) where
import Control.Monad (mzero)
@@ -15,14 +15,16 @@ import Data.List (find)
data Search = Search
{ identifier :: Text
, kind :: Text
+ , name :: Text
} deriving (Show)
instance FromJSON Search where
parseJSON (Object v) =
Search <$>
v .: "id" <*>
- v .: "type"
+ v .: "type" <*>
+ v .: "name"
parseJSON _ = mzero
-getMaterialIdentifier :: [Search] -> Maybe Text
-getMaterialIdentifier = fmap identifier . find ((==) "matiere" . kind)
+getMaterialSearch :: [Search] -> Maybe Search
+getMaterialSearch = find ((==) "matiere" . kind)