[graphql] breadcrumb: remove dead code, use node_id for argument

parent 524d698e
Pipeline #5951 passed with stages
in 92 minutes and 48 seconds
......@@ -123,19 +123,12 @@ dbParentNodes node_id parentType = do
node <- lift $ getNode id
pure [toNode node]
dbChildNodes
:: (CmdCommon env)
=> Int -> NodeType -> GqlM e env [Node]
dbChildNodes :: (CmdCommon env)
=> Int -> NodeType -> GqlM e env [Node]
dbChildNodes node_id childType = do
-- let mChildType = readEither (T.unpack child_type) :: Either Prelude.String NodeType
-- case mChildType of
-- Left err -> do
-- lift $ printDebug "[dbChildNodes] error reading parent type" (T.pack err)
-- pure []
-- Right childType -> do
childIds <- lift $ getClosestChildrenByType (NN.UnsafeMkNodeId node_id) childType -- (fromNodeTypeId parent_type_id)
children <- lift $ mapM getNode childIds
pure $ toNode <$> children
childIds <- lift $ getClosestChildrenByType (NN.UnsafeMkNodeId node_id) childType -- (fromNodeTypeId parent_type_id)
children <- lift $ mapM getNode childIds
pure $ toNode <$> children
toNode :: NN.Node json -> Node
toNode N.Node { .. } = Node { id = nid
......
......@@ -55,7 +55,7 @@ data TreeFirstLevel m = TreeFirstLevel
data BreadcrumbArgs = BreadcrumbArgs
{
nodeId :: Int
node_id :: Int
} deriving (Generic, GQLType)
data BreadcrumbInfo = BreadcrumbInfo
......@@ -118,7 +118,7 @@ nodeToTreeNode N.Node {..} =
Nothing
resolveBreadcrumb :: (CmdCommon env) => BreadcrumbArgs -> GqlM e env BreadcrumbInfo
resolveBreadcrumb BreadcrumbArgs { nodeId } = dbRecursiveParents nodeId
resolveBreadcrumb BreadcrumbArgs { node_id } = dbRecursiveParents node_id
convertDbTreeToTreeNode :: HasCallStack => T.DbTreeNode -> TreeNode
convertDbTreeToTreeNode T.DbTreeNode { _dt_name, _dt_nodeId, _dt_typeId, _dt_parentId } =
......
......@@ -176,16 +176,6 @@ getChildrenByType nId nType = do
childrenFirstLevel <- getClosestChildrenByType nId nType
childrenLst <- mapM (\id -> getChildrenByType id nType) childrenFirstLevel
pure $ childrenFirstLevel ++ concat childrenLst
-- result <- runPGSQuery query (PGS.Only nId)
-- children_lst <- mapM (\(id, _) -> getChildrenByType id nType) result
-- pure $ concat $ [fst <$> filter (\(_, pTypename) -> pTypename == toDBid nType) result] ++ children_lst
-- where
-- query :: PGS.Query
-- query = [sql|
-- SELECT n.id, n.typename
-- FROM nodes n
-- WHERE n.parent_id = ?;
-- |]
-- | Given a node id, find all it's children (only first level) of
-- given node type.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment