Commit 582b58e0 authored by Karen Konou's avatar Karen Konou

[User] Description field

parent 4e677956
Pipeline #2979 failed with stage
in 54 minutes and 10 seconds
...@@ -34,6 +34,7 @@ import Gargantext.Database.Admin.Types.Hyperdata.Contact ...@@ -34,6 +34,7 @@ import Gargantext.Database.Admin.Types.Hyperdata.Contact
, cw_organization , cw_organization
, cw_role , cw_role
, cw_touch , cw_touch
, cw_description
, ct_mail , ct_mail
, ct_phone , ct_phone
, hc_who , hc_who
...@@ -64,6 +65,7 @@ data UserInfo = UserInfo ...@@ -64,6 +65,7 @@ data UserInfo = UserInfo
, ui_cwRole :: Maybe Text , ui_cwRole :: Maybe Text
, ui_cwTouchPhone :: Maybe Text , ui_cwTouchPhone :: Maybe Text
, ui_cwTouchMail :: Maybe Text -- TODO: Remove. userLight_email should be used instead , ui_cwTouchMail :: Maybe Text -- TODO: Remove. userLight_email should be used instead
, ui_cwDescription :: Maybe Text
} }
deriving (Generic, GQLType, Show) deriving (Generic, GQLType, Show)
...@@ -91,7 +93,8 @@ data UserInfoMArgs ...@@ -91,7 +93,8 @@ data UserInfoMArgs
, ui_cwOffice :: Maybe Text , ui_cwOffice :: Maybe Text
, ui_cwRole :: Maybe Text , ui_cwRole :: Maybe Text
, ui_cwTouchPhone :: Maybe Text , ui_cwTouchPhone :: Maybe Text
, ui_cwTouchMail :: Maybe Text , ui_cwTouchMail :: Maybe Text
, ui_cwDescription :: Maybe Text
} deriving (Generic, GQLType) } deriving (Generic, GQLType)
type GqlM e env = Resolver QUERY e (GargM env GargError) type GqlM e env = Resolver QUERY e (GargM env GargError)
...@@ -132,6 +135,7 @@ updateUserInfo (UserInfoMArgs { ui_id, .. }) = do ...@@ -132,6 +135,7 @@ updateUserInfo (UserInfoMArgs { ui_id, .. }) = do
uh ui_cwRoleL ui_cwRole $ uh ui_cwRoleL ui_cwRole $
uh ui_cwTouchMailL ui_cwTouchMail $ uh ui_cwTouchMailL ui_cwTouchMail $
uh ui_cwTouchPhoneL ui_cwTouchPhone $ uh ui_cwTouchPhoneL ui_cwTouchPhone $
uh ui_cwDescriptionL ui_cwDescription
u_hyperdata u_hyperdata
-- NOTE: We have 1 username and 2 emails: userLight_email and ui_cwTouchMail -- NOTE: We have 1 username and 2 emails: userLight_email and ui_cwTouchMail
-- The userLight_email is more important: it is used for login and sending mail. -- The userLight_email is more important: it is used for login and sending mail.
...@@ -179,7 +183,8 @@ toUser (UserLight { .. }, u_hyperdata) = ...@@ -179,7 +183,8 @@ toUser (UserLight { .. }, u_hyperdata) =
, ui_cwRole = u_hyperdata ^. ui_cwRoleL , ui_cwRole = u_hyperdata ^. ui_cwRoleL
--, ui_cwTouchMail = u_hyperdata ^. ui_cwTouchMailL --, ui_cwTouchMail = u_hyperdata ^. ui_cwTouchMailL
, ui_cwTouchMail = Just userLight_email , ui_cwTouchMail = Just userLight_email
, ui_cwTouchPhone = u_hyperdata ^. ui_cwTouchPhoneL } , ui_cwTouchPhone = u_hyperdata ^. ui_cwTouchPhoneL
, ui_cwDescription = u_hyperdata ^. ui_cwDescriptionL }
sharedL :: Traversal' HyperdataUser HyperdataContact sharedL :: Traversal' HyperdataUser HyperdataContact
sharedL = hu_shared . _Just sharedL = hu_shared . _Just
...@@ -213,3 +218,5 @@ ui_cwTouchMailL = hu_shared . _Just . (hc_where . (ix 0) . cw_touch . _Just . ct ...@@ -213,3 +218,5 @@ ui_cwTouchMailL = hu_shared . _Just . (hc_where . (ix 0) . cw_touch . _Just . ct
ui_cwTouchPhoneL :: Traversal' HyperdataUser (Maybe Text) ui_cwTouchPhoneL :: Traversal' HyperdataUser (Maybe Text)
ui_cwTouchPhoneL = hu_shared . _Just . (hc_where . (ix 0) . cw_touch . _Just . ct_phone) ui_cwTouchPhoneL = hu_shared . _Just . (hc_where . (ix 0) . cw_touch . _Just . ct_phone)
--ui_cwTouchPhoneL = contactWhereL . cw_touch . _Just . ct_phone --ui_cwTouchPhoneL = contactWhereL . cw_touch . _Just . ct_phone
ui_cwDescriptionL :: Traversal' HyperdataUser (Maybe Text)
ui_cwDescriptionL = contactWhoL . cw_description
...@@ -272,7 +272,7 @@ instance ToHyperdataRow HyperdataDocument where ...@@ -272,7 +272,7 @@ instance ToHyperdataRow HyperdataDocument where
, _hr_uniqIdBdd = fromMaybe "" _hd_uniqIdBdd } , _hr_uniqIdBdd = fromMaybe "" _hd_uniqIdBdd }
instance ToHyperdataRow HyperdataContact where instance ToHyperdataRow HyperdataContact where
toHyperdataRow (HyperdataContact { _hc_who = Just (ContactWho _ fn ln _ _), _hc_where = ou} ) = toHyperdataRow (HyperdataContact { _hc_who = Just (ContactWho _ fn ln _ _ _), _hc_where = ou} ) =
HyperdataRowContact (fromMaybe "FirstName" fn) (fromMaybe "LastName" ln) ou' HyperdataRowContact (fromMaybe "FirstName" fn) (fromMaybe "LastName" ln) ou'
where where
ou' = maybe "CNRS" (Text.intercalate " " . _cw_organization) (head ou) ou' = maybe "CNRS" (Text.intercalate " " . _cw_organization) (head ou)
......
...@@ -169,7 +169,8 @@ imtUser2gargContact (IMTUser { id ...@@ -169,7 +169,8 @@ imtUser2gargContact (IMTUser { id
, _cw_firstName = prenom , _cw_firstName = prenom
, _cw_lastName = nom , _cw_lastName = nom
, _cw_keywords = catMaybes [service] , _cw_keywords = catMaybes [service]
, _cw_freetags = [] } , _cw_freetags = []
, _cw_description = Nothing }
ou = ContactWhere { _cw_organization = toList entite ou = ContactWhere { _cw_organization = toList entite
, _cw_labTeamDepts = toList service , _cw_labTeamDepts = toList service
, _cw_role = fonction , _cw_role = fonction
......
...@@ -103,6 +103,7 @@ data ContactWho = ...@@ -103,6 +103,7 @@ data ContactWho =
, _cw_lastName :: Maybe Text , _cw_lastName :: Maybe Text
, _cw_keywords :: [Text] , _cw_keywords :: [Text]
, _cw_freetags :: [Text] , _cw_freetags :: [Text]
, _cw_description :: Maybe Text
} deriving (Eq, Show, Generic) } deriving (Eq, Show, Generic)
instance GQLType ContactWho where instance GQLType ContactWho where
...@@ -120,7 +121,8 @@ contactWho fn ln = ...@@ -120,7 +121,8 @@ contactWho fn ln =
, _cw_firstName = Just fn , _cw_firstName = Just fn
, _cw_lastName = Just ln , _cw_lastName = Just ln
, _cw_keywords = [] , _cw_keywords = []
, _cw_freetags = [] } , _cw_freetags = []
, _cw_description = Nothing }
data ContactWhere = data ContactWhere =
ContactWhere { _cw_organization :: [Text] ContactWhere { _cw_organization :: [Text]
......
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