Commit 53633abe authored by Alexandre Delanoë's avatar Alexandre Delanoë

[Contact] Maybe [] -> []

parent 74bfb3c2
...@@ -44,7 +44,7 @@ type NodeContact = Node HyperdataContact ...@@ -44,7 +44,7 @@ type NodeContact = Node HyperdataContact
data HyperdataContact = data HyperdataContact =
HyperdataContact { _hc_bdd :: Maybe Text -- ID of Database source HyperdataContact { _hc_bdd :: Maybe Text -- ID of Database source
, _hc_who :: Maybe ContactWho , _hc_who :: Maybe ContactWho
, _hc_where :: Maybe [ContactWhere] , _hc_where :: [ContactWhere]
, _hc_title :: Maybe Text -- TODO remove (only demo) , _hc_title :: Maybe Text -- TODO remove (only demo)
, _hc_source :: Maybe Text -- TODO remove (only demo) , _hc_source :: Maybe Text -- TODO remove (only demo)
, _hc_lastValidation :: Maybe Text , _hc_lastValidation :: Maybe Text
...@@ -61,7 +61,7 @@ data ContactMetaData = ...@@ -61,7 +61,7 @@ data ContactMetaData =
arbitraryHyperdataContact :: HyperdataContact arbitraryHyperdataContact :: HyperdataContact
arbitraryHyperdataContact = HyperdataContact Nothing Nothing Nothing arbitraryHyperdataContact = HyperdataContact Nothing Nothing []
Nothing Nothing Nothing Nothing Nothing Nothing
Nothing Nothing Nothing Nothing
...@@ -69,13 +69,13 @@ data ContactWho = ...@@ -69,13 +69,13 @@ data ContactWho =
ContactWho { _cw_id :: Maybe Text ContactWho { _cw_id :: Maybe Text
, _cw_firstName :: Maybe Text , _cw_firstName :: Maybe Text
, _cw_lastName :: Maybe Text , _cw_lastName :: Maybe Text
, _cw_keywords :: Maybe [Text] , _cw_keywords :: [Text]
, _cw_freetags :: Maybe [Text] , _cw_freetags :: [Text]
} deriving (Eq, Show, Generic) } deriving (Eq, Show, Generic)
data ContactWhere = data ContactWhere =
ContactWhere { _cw_organization :: Maybe [Text] ContactWhere { _cw_organization :: [Text]
, _cw_labTeamDepts :: Maybe [Text] , _cw_labTeamDepts :: [Text]
, _cw_role :: Maybe Text , _cw_role :: Maybe Text
...@@ -112,7 +112,7 @@ instance ToSchema ContactWhere ...@@ -112,7 +112,7 @@ instance ToSchema ContactWhere
instance ToSchema ContactTouch instance ToSchema ContactTouch
instance Arbitrary HyperdataContact where instance Arbitrary HyperdataContact where
arbitrary = elements [HyperdataContact Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing] arbitrary = elements [HyperdataContact Nothing Nothing [] Nothing Nothing Nothing Nothing Nothing]
-- | Specific Gargantext instance -- | Specific Gargantext instance
......
...@@ -244,7 +244,7 @@ addUniqIdsContact hc = set (hc_uniqIdBdd) (Just hashBdd) ...@@ -244,7 +244,7 @@ addUniqIdsContact hc = set (hc_uniqIdBdd) (Just hashBdd)
hashParametersContact :: [(HyperdataContact -> Text)] hashParametersContact :: [(HyperdataContact -> Text)]
hashParametersContact = [ \d -> maybe' $ view (hc_who . _Just . cw_firstName) d hashParametersContact = [ \d -> maybe' $ view (hc_who . _Just . cw_firstName) d
, \d -> maybe' $ view (hc_who . _Just . cw_lastName ) d , \d -> maybe' $ view (hc_who . _Just . cw_lastName ) d
, \d -> maybe' $ view (hc_where . _Just . _head . cw_touch . _Just . ct_mail) d , \d -> maybe' $ view (hc_where . _head . cw_touch . _Just . ct_mail) d
] ]
......
...@@ -74,14 +74,14 @@ imtUser2gargContact (IMTUser id' entite' mail' nom' prenom' fonction' tel' _fax' ...@@ -74,14 +74,14 @@ imtUser2gargContact (IMTUser id' entite' mail' nom' prenom' fonction' tel' _fax'
service' _groupe' bureau' url' _pservice' _pfonction' _afonction' service' _groupe' bureau' url' _pservice' _pfonction' _afonction'
_grprech' lieu' _aprecision' _atel' _sexe' _statut' _idutilentite' _grprech' lieu' _aprecision' _atel' _sexe' _statut' _idutilentite'
_entite2' _service2' _group2' _actif' _idutilsiecoles' date_modification') _entite2' _service2' _group2' _actif' _idutilsiecoles' date_modification')
= HyperdataContact (Just "IMT Annuaire") (Just qui) (Just [ou]) ((<>) <$> (fmap (\p -> p <> " ") prenom') <*> nom') entite' date_modification' Nothing Nothing = HyperdataContact (Just "IMT Annuaire") (Just qui) [ou] ((<>) <$> (fmap (\p -> p <> " ") prenom') <*> nom') entite' date_modification' Nothing Nothing
where where
qui = ContactWho (Just id') prenom' nom' (Just $ catMaybes [service']) Nothing qui = ContactWho (Just id') prenom' nom' (catMaybes [service']) []
ou = ContactWhere (toList entite') (toList service') fonction' bureau' (Just "France") lieu' contact Nothing Nothing ou = ContactWhere (toList entite') (toList service') fonction' bureau' (Just "France") lieu' contact Nothing Nothing
contact = Just $ ContactTouch mail' tel' url' contact = Just $ ContactTouch mail' tel' url'
-- meta = ContactMetaData (Just "IMT annuaire") date_modification' -- meta = ContactMetaData (Just "IMT annuaire") date_modification'
toList Nothing = Nothing toList Nothing = []
toList (Just x) = Just [x] toList (Just x) = [x]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment