Merge remote-tracking branch 'origin/86-dev-graphql-nested' into 86-dev-graphql
[gargantext.git] / src / Gargantext / Database / Admin / Trigger / NodesNodes.hs
index 9408cbd2aa6aae366cd6fb5cf82e6fedeb190732..2f97e1aa771be5de7731eeb3ba6aee1dd4f0db39 100644 (file)
@@ -11,28 +11,25 @@ Triggers on NodesNodes table.
 
 -}
 
-{-# LANGUAGE FlexibleContexts  #-}
 {-# LANGUAGE QuasiQuotes       #-}
-{-# LANGUAGE NoImplicitPrelude #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE RankNTypes        #-}
 
 module Gargantext.Database.Admin.Trigger.NodesNodes
   where
 
 import Database.PostgreSQL.Simple.SqlQQ (sql)
 -- import Database.PostgreSQL.Simple.Types (Values(..), QualifiedIdentifier(..))
-import Gargantext.Database.Admin.Config (nodeTypeId)
+import Gargantext.Core
+import Gargantext.Database.Admin.Config
 import Gargantext.Database.Admin.Types.Node -- (ListId, CorpusId, NodeId)
-import Gargantext.Core.Types.Main (listTypeId, ListType(CandidateTerm))
-import Gargantext.Database.Admin.Utils (Cmd, execPGSQuery)
+import Gargantext.Core.Types.Main (ListType(CandidateTerm))
+import Gargantext.Database.Prelude (Cmd, execPGSQuery)
 import Gargantext.Prelude
 import qualified Database.PostgreSQL.Simple as DPS
 
 type MasterListId = ListId
 
 triggerDeleteCount :: MasterListId -> Cmd err Int64
-triggerDeleteCount lId = execPGSQuery query (lId, nodeTypeId NodeList)
+triggerDeleteCount lId = execPGSQuery query (lId, toDBid NodeList)
   where
     query :: DPS.Query
     query = [sql|
@@ -165,8 +162,8 @@ triggerCoocInsert lid = execPGSQuery query ( lid
                                            -- , nodeTypeId NodeCorpus
                                            -- , nodeTypeId NodeDocument
                                            -- , nodeTypeId NodeList
-                                           , listTypeId CandidateTerm
-                                           , listTypeId CandidateTerm
+                                           , toDBid CandidateTerm
+                                           , toDBid CandidateTerm
                                            )
   where
     query :: DPS.Query