Commit 37d8ac18 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[DB/FACT] Schema NodeNode -> Query (with warnings)

parent 2858f2ed
......@@ -67,7 +67,6 @@ import Gargantext.Database.Admin.Types.Node
import Gargantext.Database.Admin.Utils -- (Cmd, CmdM)
import Gargantext.Database.Schema.Node (node_userId, _node_typename)
import Gargantext.Database.Query.Table.NodeNode
import Gargantext.Database.Schema.NodeNode
import Gargantext.Prelude
import Gargantext.Viz.Chart
import Gargantext.Viz.Phylo.API (PhyloAPI, phyloAPI)
......
......@@ -31,13 +31,12 @@ import Gargantext.Core.Types
import Gargantext.Database.Query.Facet
import Gargantext.Database.Query.Join (leftJoin6)
import Gargantext.Database.Query.Table.Node
import Gargantext.Database.Query.Table.NodeNode
import Gargantext.Database.Query.Table.Ngrams
import Gargantext.Database.Admin.Config (nodeTypeId)
import Gargantext.Database.Admin.Types.Node (NodeType(..))
import Gargantext.Database.Admin.Utils (Cmd, runPGSQuery, runOpaQuery, runCountOpaQuery)
import Gargantext.Database.Schema.Ngrams
import Gargantext.Database.Schema.Node
import Gargantext.Database.Schema.NodeNode
import Gargantext.Database.Schema.NodeNodeNgrams
import Gargantext.Prelude
import Gargantext.Text.Terms.Mono.Stem.En (stemIt)
......
......@@ -61,7 +61,7 @@ import Gargantext.Database.Admin.Config (nodeTypeId)
import Gargantext.Database.Admin.Utils
import Gargantext.Database.Schema.Ngrams
import Gargantext.Database.Schema.Node
import Gargantext.Database.Schema.NodeNode
import Gargantext.Database.Query.Table.NodeNode
import Gargantext.Database.Schema.NodeNodeNgrams
import Opaleye
import Prelude hiding (null, id, map, sum, not, read)
......
......@@ -24,6 +24,7 @@ import Data.Proxy
import Gargantext.Core.Types
import Gargantext.Database.Query.Filter
import Gargantext.Database.Query.Table.Node
import Gargantext.Database.Query.Table.NodeNode
import Gargantext.Database.Query.Table.Node.Contact (HyperdataContact)
import Gargantext.Database.Admin.Config (nodeTypeId)
import Gargantext.Database.Admin.Types.Node (pgNodeId)
......
......@@ -24,7 +24,17 @@ commentary with @some markup@.
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
module Gargantext.Database.Query.Table.NodeNode where
module Gargantext.Database.Query.Table.NodeNode
( module Gargantext.Database.Schema.NodeNode
, queryNodeNodeTable
, selectDocsDates
, selectDocNodes
, selectDocs
, nodeNodesCategory
, getNodeNode
, insertNodeNode
)
where
import Control.Arrow (returnA)
import Control.Lens (view, (^.))
......@@ -44,6 +54,14 @@ import Opaleye
import qualified Database.PostgreSQL.Simple as PGS (Query, Only(..))
import qualified Opaleye as O
queryNodeNodeTable :: Query NodeNodeRead
queryNodeNodeTable = queryTable nodeNodeTable
-- | not optimized (get all ngrams without filters)
nodesNodes :: Cmd err [NodeNode]
nodesNodes = runOpaQuery queryNodeNodeTable
------------------------------------------------------------------------
-- | Basic NodeNode tools
getNodeNode :: NodeId -> Cmd err [NodeNode]
......
......@@ -38,7 +38,6 @@ import Data.Swagger (ToParamSchema, toParamSchema, ToSchema)
import Data.Text (Text, splitOn, pack)
import GHC.Generics (Generic)
import Gargantext.Core.Types (TODO(..))
import Gargantext.Database.Admin.Utils (Cmd, runPGSQuery, runOpaQuery, formatPGSQuery)
import Gargantext.Prelude
import Prelude (Enum, Bounded, minBound, maxBound, Functor)
import Servant (FromHttpApiData, parseUrlPiece, Proxy(..))
......
......@@ -28,7 +28,6 @@ module Gargantext.Database.Schema.NodeNode where
import Data.Maybe (Maybe)
import Gargantext.Core.Types
import Gargantext.Database.Admin.Utils
import Gargantext.Database.Schema.Prelude
import Gargantext.Prelude
......@@ -69,14 +68,8 @@ nodeNodeTable = Table "nodes_nodes" (pNodeNode
}
)
queryNodeNodeTable :: Query NodeNodeRead
queryNodeNodeTable = queryTable nodeNodeTable
-- | not optimized (get all ngrams without filters)
nodesNodes :: Cmd err [NodeNode]
nodesNodes = runOpaQuery queryNodeNodeTable
instance QueryRunnerColumnDefault (Nullable PGInt4) Int where
queryRunnerColumnDefault = fieldQueryRunnerColumn
......
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