Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Przemyslaw Kaminski
haskell-gargantext
Commits
872564e3
Commit
872564e3
authored
Nov 04, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[graphql] userinfo mutation work
parent
f4396192
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
GraphQL.hs
src/Gargantext/API/GraphQL.hs
+1
-1
UserInfo.hs
src/Gargantext/API/GraphQL/UserInfo.hs
+6
-2
No files found.
src/Gargantext/API/GraphQL.hs
View file @
872564e3
...
...
@@ -82,7 +82,7 @@ data Query m
data
Mutation
m
=
Mutation
{
update_user_info
::
GQLUserInfo
.
UserInfoMArgs
->
m
GQLUserInfo
.
UserInfo
}
{
update_user_info
::
GQLUserInfo
.
UserInfoMArgs
->
m
Int
}
deriving
(
Generic
,
GQLType
)
-- | Possible GraphQL Events, i.e. here we describe how we will
...
...
src/Gargantext/API/GraphQL/UserInfo.hs
View file @
872564e3
...
...
@@ -36,7 +36,9 @@ import Gargantext.Database.Admin.Types.Hyperdata.Contact
,
ct_phone
,
hc_who
,
hc_where
)
import
Gargantext.Database.Admin.Types.Node
(
NodeId
(
..
))
import
Gargantext.Database.Prelude
(
HasConnectionPool
,
HasConfig
)
import
Gargantext.Database.Query.Table.Node.UpdateOpaleye
(
updateHyperdata
)
import
Gargantext.Database.Query.Table.User
(
getUsersWithHyperdata
)
import
Gargantext.Database.Schema.User
(
UserLight
(
..
))
import
Gargantext.Prelude
...
...
@@ -97,7 +99,7 @@ resolveUserInfos UserInfoArgs { user_id } = dbUsers user_id
-- | Mutation for user info
updateUserInfo
::
(
HasConnectionPool
env
,
HasConfig
env
)
=>
UserInfoMArgs
->
ResolverM
e
(
GargM
env
GargError
)
UserInfo
=>
UserInfoMArgs
->
ResolverM
e
(
GargM
env
GargError
)
Int
updateUserInfo
(
UserInfoMArgs
{
ui_id
,
..
})
=
do
lift
$
printDebug
"[updateUserInfo] ui_id"
ui_id
users
<-
lift
(
getUsersWithHyperdata
ui_id
)
...
...
@@ -119,7 +121,9 @@ updateUserInfo (UserInfoMArgs { ui_id, .. }) = do
uh
ui_cwTouchPhoneL
ui_cwTouchPhone
$
u_hyperdata
lift
$
printDebug
"[updateUserInfo] with firstName"
u_hyperdata'
pure
$
toUser
(
u
,
u_hyperdata'
)
_
<-
lift
$
updateHyperdata
(
NodeId
ui_id
)
u_hyperdata'
--let _newUser = toUser (u, u_hyperdata')
pure
1
where
uh
_
Nothing
u_hyperdata
=
u_hyperdata
uh
lens'
(
Just
val
)
u_hyperdata
=
u_hyperdata
&
lens'
.~
Just
val
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment