Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
141
Issues
141
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
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
gargantext
haskell-gargantext
Commits
713a27d1
Commit
713a27d1
authored
Sep 24, 2022
by
Karen Konou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[GQL] Add team leader to query
parent
bf006791
Pipeline
#3197
passed with stage
in 99 minutes and 55 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
GraphQL.hs
src/Gargantext/API/GraphQL.hs
+1
-1
Team.hs
src/Gargantext/API/GraphQL/Team.hs
+17
-5
No files found.
src/Gargantext/API/GraphQL.hs
View file @
713a27d1
...
...
@@ -73,7 +73,7 @@ data Query m
,
user_infos
::
GQLUserInfo
.
UserInfoArgs
->
m
[
GQLUserInfo
.
UserInfo
]
,
users
::
GQLUser
.
UserArgs
->
m
[
GQLUser
.
User
m
]
,
tree
::
GQLTree
.
TreeArgs
->
m
(
GQLTree
.
TreeFirstLevel
m
)
,
team
::
GQLTeam
.
TeamArgs
->
m
[
GQLTeam
.
TeamMember
]
,
team
::
GQLTeam
.
TeamArgs
->
m
GQLTeam
.
Team
}
deriving
(
Generic
,
GQLType
)
data
Mutation
m
...
...
src/Gargantext/API/GraphQL/Team.hs
View file @
713a27d1
...
...
@@ -20,10 +20,16 @@ import Gargantext.API.Admin.Types (HasSettings)
import
Gargantext.Database.Query.Table.User
(
getUsersWithNodeHyperdata
)
import
qualified
Data.Text
as
T
import
Gargantext.Database.Schema.User
(
UserLight
(
..
))
data
TeamArgs
=
TeamArgs
{
team_node_id
::
Int
}
deriving
(
Generic
,
GQLType
)
data
Team
=
Team
{
team_leader_username
::
Text
,
team_members
::
[
TeamMember
]
}
deriving
(
Generic
,
GQLType
)
data
TeamMember
=
TeamMember
{
username
::
Text
,
shared_folder_id
::
Int
...
...
@@ -38,23 +44,29 @@ data TeamDeleteMArgs = TeamDeleteMArgs
type
GqlM
e
env
=
Resolver
QUERY
e
(
GargM
env
GargError
)
type
GqlM'
e
env
a
=
ResolverM
e
(
GargM
env
GargError
)
a
todo
::
a
todo
=
undefined
resolveTeam
::
(
HasConnectionPool
env
,
HasConfig
env
,
HasMail
env
)
=>
TeamArgs
->
GqlM
e
env
[
TeamMember
]
resolveTeam
::
(
HasConnectionPool
env
,
HasConfig
env
,
HasMail
env
)
=>
TeamArgs
->
GqlM
e
env
Team
resolveTeam
TeamArgs
{
team_node_id
}
=
dbTeam
team_node_id
dbTeam
::
(
HasConnectionPool
env
,
HasConfig
env
,
HasMail
env
)
=>
Int
->
GqlM
e
env
[
TeamMember
]
dbTeam
::
(
HasConnectionPool
env
,
HasConfig
env
,
HasMail
env
)
=>
Int
->
GqlM
e
env
Team
dbTeam
nodeId
=
do
let
nId
=
NodeId
nodeId
res
<-
lift
$
membersOf
nId
pure
$
map
toTeamMember
res
teamNode
<-
lift
$
getNode
nId
userNodes
<-
lift
$
getUsersWithNodeHyperdata
$
uId
teamNode
let
username
=
getUsername
userNodes
pure
$
Team
{
team_leader_username
=
username
,
team_members
=
map
toTeamMember
res
}
where
toTeamMember
::
(
Text
,
NodeId
)
->
TeamMember
toTeamMember
(
username
,
fId
)
=
TeamMember
{
username
,
shared_folder_id
=
unNodeId
fId
}
uId
Node
{
_node_user_id
}
=
_node_user_id
getUsername
[]
=
panic
"[resolveTeam] Team creator doesn't exist"
getUsername
((
UserLight
{
userLight_username
},
_
)
:
_
)
=
userLight_username
-- TODO: list as argument
deleteTeamMembership
::
(
HasConnectionPool
env
,
HasConfig
env
,
HasMail
env
,
HasSettings
env
)
=>
TeamDeleteMArgs
->
GqlM'
e
env
[
Int
]
...
...
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