Commit 22c8974d authored by Karen Konou's avatar Karen Konou

[User] description field

parent f94c4685
...@@ -24,7 +24,8 @@ type UserInfo ...@@ -24,7 +24,8 @@ type UserInfo
, ui_cwCountry :: Maybe String , ui_cwCountry :: Maybe String
, ui_cwRole :: Maybe String , ui_cwRole :: Maybe String
, ui_cwTouchPhone :: Maybe String , ui_cwTouchPhone :: Maybe String
, ui_cwTouchMail :: Maybe String } , ui_cwTouchMail :: Maybe String
, ui_cwDescription :: Maybe String }
type UserInfoM type UserInfoM
= { token :: NotNull String = { token :: NotNull String
, ui_id :: NotNull Int , ui_id :: NotNull Int
...@@ -41,7 +42,8 @@ type UserInfoM ...@@ -41,7 +42,8 @@ type UserInfoM
, ui_cwCountry :: String , ui_cwCountry :: String
, ui_cwRole :: String , ui_cwRole :: String
, ui_cwTouchPhone :: String , ui_cwTouchPhone :: String
, ui_cwTouchMail :: String } , ui_cwTouchMail :: String
, ui_cwDescription :: String }
userInfoQuery = { user_infos: { user_id: Var :: _ "id" Int } =>> userInfoQuery = { user_infos: { user_id: Var :: _ "id" Int } =>>
{ ui_id: unit { ui_id: unit
...@@ -58,7 +60,8 @@ userInfoQuery = { user_infos: { user_id: Var :: _ "id" Int } =>> ...@@ -58,7 +60,8 @@ userInfoQuery = { user_infos: { user_id: Var :: _ "id" Int } =>>
, ui_cwOffice: unit , ui_cwOffice: unit
, ui_cwRole: unit , ui_cwRole: unit
, ui_cwTouchMail: unit , ui_cwTouchMail: unit
, ui_cwTouchPhone: unit } , ui_cwTouchPhone: unit
, ui_cwDescription: unit }
} }
_ui_cwFirstName :: Lens' UserInfo String _ui_cwFirstName :: Lens' UserInfo String
...@@ -122,6 +125,12 @@ _ui_cwTouchPhone = lens getter setter ...@@ -122,6 +125,12 @@ _ui_cwTouchPhone = lens getter setter
getter ({ ui_cwTouchPhone: val }) = fromMaybe "" val getter ({ ui_cwTouchPhone: val }) = fromMaybe "" val
setter ui val = ui { ui_cwTouchPhone = Just val } setter ui val = ui { ui_cwTouchPhone = Just val }
_ui_cwDescription :: Lens' UserInfo String
_ui_cwDescription = lens getter setter
where
getter ({ui_cwDescription: val}) = fromMaybe "" val
setter ui val = ui { ui_cwDescription = Just val }
type User type User
= { u_id :: Int = { u_id :: Int
, u_hyperdata :: , u_hyperdata ::
......
...@@ -16,7 +16,7 @@ import Effect.Class (liftEffect) ...@@ -16,7 +16,7 @@ import Effect.Class (liftEffect)
import Gargantext.Components.App.Store (Boxes) import Gargantext.Components.App.Store (Boxes)
import Gargantext.Components.GraphQL (getClient) import Gargantext.Components.GraphQL (getClient)
import Gargantext.Components.GraphQL.Endpoints (getUserInfo) import Gargantext.Components.GraphQL.Endpoints (getUserInfo)
import Gargantext.Components.GraphQL.User (UserInfo, _ui_cwCity, _ui_cwCountry, _ui_cwFirstName, _ui_cwLabTeamDeptsFirst, _ui_cwLastName, _ui_cwOffice, _ui_cwOrganizationFirst, _ui_cwRole, _ui_cwTouchMail, _ui_cwTouchPhone) import Gargantext.Components.GraphQL.User (UserInfo, _ui_cwCity, _ui_cwCountry, _ui_cwFirstName, _ui_cwLabTeamDeptsFirst, _ui_cwLastName, _ui_cwOffice, _ui_cwOrganizationFirst, _ui_cwRole, _ui_cwTouchMail, _ui_cwTouchPhone, _ui_cwDescription)
import Gargantext.Components.InputWithEnter (inputWithEnter) import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Nodes.Annuaire.Tabs as Tabs import Gargantext.Components.Nodes.Annuaire.Tabs as Tabs
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (Contact(..), ContactData, ContactTouch(..), ContactWhere(..), ContactWho(..), HyperdataContact(..), HyperdataUser(..), _city, _country, _firstName, _labTeamDeptsJoinComma, _lastName, _mail, _office, _organizationJoinComma, _ouFirst, _phone, _role, _shared, _touch, _who, defaultContactTouch, defaultContactWhere, defaultContactWho, defaultHyperdataContact, defaultHyperdataUser) import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (Contact(..), ContactData, ContactTouch(..), ContactWhere(..), ContactWho(..), HyperdataContact(..), HyperdataUser(..), _city, _country, _firstName, _labTeamDeptsJoinComma, _lastName, _mail, _office, _organizationJoinComma, _ouFirst, _phone, _role, _shared, _touch, _who, defaultContactTouch, defaultContactWhere, defaultContactWho, defaultHyperdataContact, defaultHyperdataUser)
...@@ -170,6 +170,7 @@ contactInfoItems = ...@@ -170,6 +170,7 @@ contactInfoItems =
, { label: "Role" , defaultVal: "Empty Role" , lens: _ui_cwRole } , { label: "Role" , defaultVal: "Empty Role" , lens: _ui_cwRole }
, { label: "Phone" , defaultVal: "Empty Phone" , lens: _ui_cwTouchPhone } , { label: "Phone" , defaultVal: "Empty Phone" , lens: _ui_cwTouchPhone }
, { label: "Mail" , defaultVal: "Empty Mail" , lens: _ui_cwTouchMail } , { label: "Mail" , defaultVal: "Empty Mail" , lens: _ui_cwTouchMail }
, { label: "Description" , defaultVal: "No description" , lens: _ui_cwDescription }
] ]
type UserInfoLens = L.ALens' UserInfo String type UserInfoLens = L.ALens' UserInfo String
...@@ -284,7 +285,8 @@ saveUserInfo session id ui = do ...@@ -284,7 +285,8 @@ saveUserInfo session id ui = do
, ui_cwCountry: ga ui.ui_cwCountry , ui_cwCountry: ga ui.ui_cwCountry
, ui_cwRole: ga ui.ui_cwRole , ui_cwRole: ga ui.ui_cwRole
, ui_cwTouchPhone: ga ui.ui_cwTouchPhone , ui_cwTouchPhone: ga ui.ui_cwTouchPhone
, ui_cwTouchMail: ga ui.ui_cwTouchMail } } , ui_cwTouchMail: ga ui.ui_cwTouchMail
, ui_cwDescription: ga ui.ui_cwDescription } }
pure $ Right res.update_user_info pure $ Right res.update_user_info
where where
ga Nothing = ArgL IgnoreArg ga Nothing = ArgL IgnoreArg
......
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