[FIX MERGE] with dev and testing (social lists)
[gargantext.git] / src / Gargantext / Database / Schema / NodeNode.hs
index 6114c5d9839140bc3bd1ec1b429c6476993cd6cc..f2c0b15173da16c52b492efcd2442e5f130fac0c 100644 (file)
@@ -14,36 +14,15 @@ commentary with @some markup@.
 {-# OPTIONS_GHC -fno-warn-orphans #-}
 
 {-# LANGUAGE Arrows                 #-}
-{-# LANGUAGE FlexibleContexts       #-}
-{-# LANGUAGE FlexibleInstances      #-}
 {-# LANGUAGE FunctionalDependencies #-}
 {-# LANGUAGE QuasiQuotes            #-}
-{-# LANGUAGE MultiParamTypeClasses  #-}
-{-# LANGUAGE NoImplicitPrelude      #-}
-{-# LANGUAGE OverloadedStrings      #-}
-{-# LANGUAGE RankNTypes             #-}
 {-# LANGUAGE TemplateHaskell        #-}
 
 module Gargantext.Database.Schema.NodeNode where
 
-import Control.Arrow (returnA)
-import Control.Lens (view, (^.))
-import Control.Lens.TH (makeLenses)
-import Data.Maybe (Maybe, catMaybes)
-import Data.Profunctor.Product.TH (makeAdaptorAndInstance)
-import Data.Text (Text, splitOn)
-import Database.PostgreSQL.Simple.SqlQQ (sql)
-import Database.PostgreSQL.Simple.Types (Values(..), QualifiedIdentifier(..))
 import Gargantext.Core.Types
-import Gargantext.Database.Admin.Types.Node (pgNodeId)
-import Gargantext.Database.Admin.Config (nodeTypeId)
-import Gargantext.Database.Admin.Types.Node (CorpusId, DocId)
-import Gargantext.Database.Admin.Utils
-import Gargantext.Database.Schema.Node
+import Gargantext.Database.Schema.Prelude
 import Gargantext.Prelude
-import Opaleye
-import qualified Database.PostgreSQL.Simple as PGS (Query, Only(..))
-import qualified Opaleye as O
 
 
 data NodeNodePoly node1_id node2_id score cat
@@ -74,21 +53,15 @@ $(makeAdaptorAndInstance "pNodeNode" ''NodeNodePoly)
 makeLenses ''NodeNodePoly
 
 nodeNodeTable :: Table NodeNodeWrite NodeNodeRead
-nodeNodeTable  = Table "nodes_nodes" (pNodeNode
-                                NodeNode { _nn_node1_id = required "node1_id"
-                                         , _nn_node2_id = required "node2_id"
-                                         , _nn_score    = optional "score"
-                                         , _nn_category = optional "category"
-                                     }
-                                     )
-
-queryNodeNodeTable :: Query NodeNodeRead
-queryNodeNodeTable = queryTable nodeNodeTable
-
-
--- | not optimized (get all ngrams without filters)
-nodesNodes :: Cmd err [NodeNode]
-nodesNodes = runOpaQuery queryNodeNodeTable
+nodeNodeTable  =
+  Table "nodes_nodes"
+         ( pNodeNode
+           NodeNode { _nn_node1_id = required "node1_id"
+                    , _nn_node2_id = required "node2_id"
+                    , _nn_score    = optional "score"
+                    , _nn_category = optional "category"
+                    }
+                )
 
 instance QueryRunnerColumnDefault (Nullable PGInt4)   Int            where
     queryRunnerColumnDefault = fieldQueryRunnerColumn