, Resolver
, ResolverM
, QUERY
+ , description
, lift
)
import Data.Text (Text)
, cw_organization
, cw_role
, cw_touch
+ , cw_description
, ct_mail
, ct_phone
, hc_who
, ui_cwRole :: Maybe Text
, ui_cwTouchPhone :: Maybe Text
, ui_cwTouchMail :: Maybe Text -- TODO: Remove. userLight_email should be used instead
+ , ui_cwDescription :: Maybe Text
}
- deriving (Generic, GQLType, Show)
+ deriving (Generic, Show)
+instance GQLType UserInfo where
+ description = const $ Just "provides user info"
-- | Arguments to the "user info" query.
data UserInfoArgs
, ui_cwOffice :: Maybe Text
, ui_cwRole :: Maybe Text
, ui_cwTouchPhone :: Maybe Text
- , ui_cwTouchMail :: Maybe Text
+ , ui_cwTouchMail :: Maybe Text
+ , ui_cwDescription :: Maybe Text
} deriving (Generic, GQLType)
type GqlM e env = Resolver QUERY e (GargM env GargError)
uh ui_cwRoleL ui_cwRole $
uh ui_cwTouchMailL ui_cwTouchMail $
uh ui_cwTouchPhoneL ui_cwTouchPhone $
+ uh ui_cwDescriptionL ui_cwDescription
u_hyperdata
-- 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.
-- Therefore we update ui_cwTouchMail and userLight_email.
-- ui_cwTouchMail is to be removed in the future.
- let u' = UserLight { userLight_email = fromMaybe userLight_email $ view ui_cwTouchMailL u_hyperdata
+ let u' = UserLight { userLight_email = fromMaybe userLight_email $ view ui_cwTouchMailL u_hyperdata'
, .. }
-- lift $ printDebug "[updateUserInfo] with firstName" u_hyperdata'
_ <- lift $ updateHyperdata (node_u ^. node_id) u_hyperdata'
, ui_cwRole = u_hyperdata ^. ui_cwRoleL
--, ui_cwTouchMail = u_hyperdata ^. ui_cwTouchMailL
, 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 = hu_shared . _Just
ui_cwTouchPhoneL :: Traversal' HyperdataUser (Maybe Text)
ui_cwTouchPhoneL = hu_shared . _Just . (hc_where . (ix 0) . cw_touch . _Just . ct_phone)
--ui_cwTouchPhoneL = contactWhereL . cw_touch . _Just . ct_phone
+ui_cwDescriptionL :: Traversal' HyperdataUser (Maybe Text)
+ui_cwDescriptionL = contactWhoL . cw_description