diff options
Diffstat (limited to 'src/Model/Json')
-rw-r--r-- | src/Model/Json/Search.hs | 10 |
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) |