Commit 984e2035 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[graphql] deriving field query experiments

parent af455fde
......@@ -7,6 +7,59 @@ let overrides =
, repo = "https://github.com/purescript/purescript-globals"
, version = "v4.1.0"
}
, graphql-client =
{ dependencies =
[ "aff"
, "aff-promise"
, "affjax"
, "argonaut-codecs"
, "argonaut-core"
, "arrays"
, "bifunctors"
, "control"
, "datetime"
, "debug"
, "effect"
, "either"
, "enums"
, "exceptions"
, "foldable-traversable"
, "foreign"
, "foreign-generic"
, "foreign-object"
, "functions"
, "halogen-subscriptions"
, "heterogeneous"
, "http-methods"
, "integers"
, "lists"
, "maybe"
, "media-types"
, "newtype"
, "node-buffer"
, "node-fs"
, "nullable"
, "numbers"
, "ordered-collections"
, "parsing"
, "prelude"
, "profunctor"
, "profunctor-lenses"
, "psci-support"
, "quickcheck"
, "record"
, "spec"
, "spec-discovery"
, "string-parsers"
, "strings"
, "strings-extra"
, "transformers"
, "tuples"
, "unicode"
]
, repo = "https://github.com/OxfordAbstracts/purescript-graphql-client"
, version = "34df2d4eaf3be5d66fb6f48963be5b2e715ab290"
}
, smolder =
{ dependencies =
[ "bifunctors"
......
module Gargantext.Components.GraphQL.User where
import Data.Maybe (Maybe(..), maybe)
import Gargantext.Prelude
import Data.Maybe (Maybe(..), maybe)
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (HyperdataUser(..))
import GraphQL.Client.GetFields (getFieldsStandard)
import Type.Proxy (Proxy(..))
uFields = getFieldsStandard (Proxy :: _ User)
huFields = getFieldsStandard (Proxy :: _ HyperdataUser)
type User
= { u_id :: Int
, u_hyperdata ::
......
......@@ -16,6 +16,7 @@ import Effect.Aff (Aff, launchAff_)
import Effect.Class (liftEffect)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.GraphQL (queryGql)
import Gargantext.Components.GraphQL.User (uFields, huFields)
import Gargantext.Components.InputWithEnter (inputWithEnter)
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)
......@@ -245,17 +246,18 @@ getUser session id = do
{ users } <- queryGql "get user"
{ users: { user_id: id } =>>
{ u_id
, u_hyperdata:
{ _hu_shared:
{ _hc_title
, _hc_source
, _hc_who:
{ _cw_firstName
, _cw_lastName }
, _hc_where:
{ _cw_organization }
}
}
, u_hyperdata: huFields
-- , u_hyperdata:
-- { _hu_shared:
-- { _hc_title
-- , _hc_source
-- , _hc_who:
-- { _cw_firstName
-- , _cw_lastName }
-- , _hc_where:
-- { _cw_organization }
-- }
-- }
, u_username
, u_email } }
liftEffect $ here.log2 "[getUser] users" users
......
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