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
159
Issues
159
List
Board
Labels
Milestones
Merge Requests
9
Merge Requests
9
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
b0e60b8c
Commit
b0e60b8c
authored
Mar 28, 2022
by
Karen Konou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[GQL] Encode NodeType as GQL type
parent
3cc3edfe
Pipeline
#2610
failed with stage
in 54 minutes and 19 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
TreeFirstLevel.hs
src/Gargantext/API/GraphQL/TreeFirstLevel.hs
+4
-4
Node.hs
src/Gargantext/Database/Admin/Types/Node.hs
+2
-0
No files found.
src/Gargantext/API/GraphQL/TreeFirstLevel.hs
View file @
b0e60b8c
...
...
@@ -6,13 +6,13 @@ module Gargantext.API.GraphQL.TreeFirstLevel where
import
Gargantext.Prelude
import
Data.Morpheus.Types
(
GQLType
,
lift
,
Resolver
,
QUERY
)
import
GHC.Generics
(
Generic
)
import
Data.Text
(
Text
,
pack
)
import
Data.Text
(
Text
)
import
Gargantext.API.Prelude
(
GargM
,
GargError
)
import
Gargantext.Database.Prelude
(
HasConnectionPool
,
HasConfig
)
import
Gargantext.Core.Mail.Types
(
HasMail
)
import
qualified
Gargantext.Database.Query.Tree
as
T
import
Gargantext.Database.Admin.Types.Node
(
allNodeTypes
,
NodeId
(
NodeId
))
import
Gargantext.Core.Types
(
Tree
,
NodeTree
)
import
Gargantext.Core.Types
(
Tree
,
NodeTree
,
NodeType
)
import
Gargantext.Core.Types.Main
(
Tree
(
TreeN
),
_tn_node
,
_tn_children
,
NodeTree
(
NodeTree
,
_nt_id
,
_nt_type
),
_nt_name
)
...
...
@@ -25,7 +25,7 @@ data TreeNode = TreeNode
{
name
::
Text
,
id
::
Int
,
node_type
::
Text
,
node_type
::
NodeType
}
deriving
(
Generic
,
GQLType
)
data
TreeFirstLevel
=
TreeFirstLevel
...
...
@@ -53,7 +53,7 @@ toTree TreeN {_tn_node, _tn_children} = TreeFirstLevel
}
toTreeNode
::
NodeTree
->
TreeNode
toTreeNode
NodeTree
{
_nt_name
,
_nt_id
,
_nt_type
}
=
TreeNode
{
name
=
_nt_name
,
id
=
id2int
_nt_id
,
node_type
=
pack
$
show
_nt_type
}
toTreeNode
NodeTree
{
_nt_name
,
_nt_id
,
_nt_type
}
=
TreeNode
{
name
=
_nt_name
,
id
=
id2int
_nt_id
,
node_type
=
_nt_type
}
where
id2int
::
NodeId
->
Int
id2int
(
NodeId
n
)
=
n
...
...
src/Gargantext/Database/Admin/Types/Node.hs
View file @
b0e60b8c
...
...
@@ -356,6 +356,8 @@ data NodeType = NodeUser
deriving
(
Show
,
Read
,
Eq
,
Generic
,
Bounded
,
Enum
)
instance
GQLType
NodeType
allNodeTypes
::
[
NodeType
]
allNodeTypes
=
[
minBound
..
]
...
...
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