Tree.purs 883 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
module Gargantext.Components.GraphQL.Tree where

import Gargantext.Prelude

import Data.Maybe (Maybe)
import Gargantext.Types (NodeType)
import GraphQL.Client.Args ((=>>))
import GraphQL.Client.Variable (Var(..))

type TreeNode =
  { name      :: String
  , id        :: Int
  , node_type :: NodeType
14
  , parent_id :: Maybe Int
15 16 17 18 19 20 21 22 23 24 25
  }
type TreeFirstLevel =
  { root     :: TreeNode
  , children :: Array TreeNode
  , parent   :: Maybe TreeNode
  }

treeFirstLevelQuery = { tree: { root_id: Var :: _ "id" Int} =>>
  { root: { name: unit
          , node_type: unit
          , id: unit
26
          , parent_id: unit
27 28 29 30
          }
  , children: { name: unit
              , node_type: unit
              , id: unit
31
              , parent_id: unit
32 33 34 35
              }
  , parent: { name: unit
            , node_type: unit
            , id: unit
36
            , parent_id: unit
37 38 39
            }
  }
 }