{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
-{-# LANGUAGE Arrows #-}
-{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE FlexibleContexts #-}
-{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE Arrows #-}
module Gargantext.Database.Query.Table.Node.Children
where
import Control.Arrow (returnA)
import Data.Proxy
import Gargantext.Core.Types
-import Gargantext.Database.Query.Filter
-import Gargantext.Database.Query.Table.Node
-import Gargantext.Database.Query.Table.Node.Contact (HyperdataContact)
import Gargantext.Database.Admin.Config (nodeTypeId)
-import Gargantext.Database.Admin.Types.Node (pgNodeId)
-import Gargantext.Database.Admin.Utils
+import Gargantext.Database.Admin.Types.Hyperdata (HyperdataDocument, HyperdataContact)
+import Gargantext.Database.Prelude
+import Gargantext.Database.Query.Filter
+import Gargantext.Database.Query.Table.NodeNode
import Gargantext.Database.Schema.Node
-import Gargantext.Database.Schema.NodeNode
import Opaleye
+import Protolude
+
+-- TODO getAllTableDocuments
getAllDocuments :: ParentId -> Cmd err (TableResult (Node HyperdataDocument))
getAllDocuments pId = getAllChildren pId (Proxy :: Proxy HyperdataDocument)
(Just NodeDocument)
+-- TODO getAllTableContacts
getAllContacts :: ParentId -> Cmd err (TableResult (Node HyperdataContact))
getAllContacts pId = getAllChildren pId (Proxy :: Proxy HyperdataContact)
(Just NodeContact)
-> Maybe NodeType
-> Query NodeRead
selectChildren parentId maybeNodeType = proc () -> do
- row@(Node nId typeName _ parent_id _ _ _) <- queryNodeTable -< ()
+ row@(Node nId _ typeName _ parent_id _ _ _) <- queryNodeTable -< ()
(NodeNode n1id n2id _ _) <- queryNodeNodeTable -< ()
let nodeType = maybe 0 nodeTypeId maybeNodeType