Commit 113248dd authored by Alexandre Delanoë's avatar Alexandre Delanoë

[DB|WIP] fixing imports still.

parent f7186aaa
Pipeline #815 failed with stage
......@@ -44,8 +44,8 @@ import Gargantext.API.Settings
import Gargantext.API.Types (HasJoseError(..), joseError, HasServerError, GargServerC)
import Gargantext.Core.Types.Individu (User(..), Username, Password, arbitraryUsername, arbitraryPassword)
import Gargantext.Core.Utils.Prefix (unPrefix, unPrefixSwagger)
import Gargantext.Database.Action.Root (getRoot)
import Gargantext.Database.Action.Tree (isDescendantOf, isIn)
import Gargantext.Database.Action.Query.Tree.Root (getRoot)
import Gargantext.Database.Action.Query.Tree (isDescendantOf, isIn)
import Gargantext.Database.Admin.Types.Node (NodePoly(_node_id), NodeId(..), UserId, ListId, DocId)
import Gargantext.Database.Admin.Utils (Cmd', CmdM, HasConnectionPool)
import Gargantext.Prelude hiding (reverse)
......
......@@ -38,13 +38,13 @@ import Gargantext.API.Types (GargNoServer)
import Gargantext.Core.Types --
import Gargantext.Core.Utils.Prefix (unPrefix, unPrefixSwagger)
import Gargantext.Database.Action.Metrics.NgramsByNode (getNgramsByNodeOnlyUser)
import Gargantext.Database.Action.Query.Node
import Gargantext.Database.Action.Query.Node.Select (selectNodesWithUsername)
import Gargantext.Database.Admin.Config (userMaster)
import Gargantext.Database.Admin.Types.Errors (HasNodeError)
import Gargantext.Database.Admin.Types.Node (Node, HyperdataDocument(..), NodeId, ListId, CorpusId)
import Gargantext.Database.Admin.Utils (Cmd)
import Gargantext.Database.Schema.Ngrams (NgramsType(..))
import Gargantext.Database.Schema.Node (defaultList)
import Gargantext.Database.Schema.NodeNode (selectDocNodes)
import Gargantext.Prelude
import Gargantext.Prelude.Utils (sha)
......
......@@ -53,25 +53,27 @@ import Gargantext.API.Table
import Gargantext.API.Types
import Gargantext.Core.Types (NodeTableResult)
import Gargantext.Core.Types.Main (Tree, NodeTree, ListType)
import Gargantext.Database.Action.Facet (FacetDoc, OrderBy(..))
import Gargantext.Database.Action.Query.Facet (FacetDoc, OrderBy(..))
import Gargantext.Database.Action.Flow.Pairing (pairing)
import Gargantext.Database.Action.Query.Node.Children (getChildren)
import Gargantext.Database.Action.Query.Node.UpdateOpaleye (updateHyperdata)
import Gargantext.Database.Action.Query.Node.User (NodeUser)
import Gargantext.Database.Action.Tree (treeDB)
import Gargantext.Database.Action.Query.Node.User
import Gargantext.Database.Action.Query.Node hiding (postNode)
import Gargantext.Database.Action.Query
import Gargantext.Database.Action.Query.Tree (treeDB)
import Gargantext.Database.Admin.Config (nodeTypeId)
import Gargantext.Database.Admin.Types.Errors (HasNodeError(..))
import Gargantext.Database.Admin.Types.Node
import Gargantext.Database.Admin.Utils -- (Cmd, CmdM)
import Gargantext.Database.Schema.Node (getNodesWithParentId, getNodeWith, getNode, deleteNode, deleteNodes, mkNodeWithParent, JSONB, getNodeUser)
import Gargantext.Database.Schema.NodeNode -- (nodeNodesCategory, insertNodeNode, NodeNode(..))
import Gargantext.Database.Schema.Node
import Gargantext.Database.Schema.NodeNode
import Gargantext.Prelude
import Gargantext.Viz.Chart
import Gargantext.Viz.Phylo.API (PhyloAPI, phyloAPI)
import Servant
import Test.QuickCheck (elements)
import Test.QuickCheck.Arbitrary (Arbitrary, arbitrary)
import qualified Gargantext.Database.Node.Update as U (update, Update(..))
import qualified Gargantext.Database.Action.Query.Node.Update as U (update, Update(..))
{-
import qualified Gargantext.Text.List.Learn as Learn
......@@ -94,7 +96,7 @@ nodesAPI ids = deleteNodes ids
-- TODO-EVENTS:
-- PutNode ?
-- TODO needs design discussion.
type Roots = Get '[JSON] [NodeUser]
type Roots = Get '[JSON] [Node HyperdataUser]
:<|> Put '[JSON] Int -- TODO
-- | TODO: access by admin only
......
......@@ -32,7 +32,7 @@ import Data.Time (UTCTime)
import GHC.Generics (Generic)
import Gargantext.API.Types (GargServer)
import Gargantext.Core.Utils.Prefix (unPrefix, unPrefixSwagger)
import Gargantext.Database.Action.Facet
import Gargantext.Database.Action.Query.Facet
import Gargantext.Database.Action.Search
import Gargantext.Database.Admin.Types.Node
import Gargantext.Prelude
......
......@@ -46,7 +46,7 @@ import GHC.Generics (Generic)
import Gargantext.API.Ngrams (TabType(..))
import Gargantext.Core.Types (Offset, Limit, TableResult(..))
import Gargantext.Core.Utils.Prefix (unPrefix, unPrefixSwagger)
import Gargantext.Database.Action.Facet (FacetDoc , runViewDocuments, OrderBy(..), runViewAuthorsDoc)
import Gargantext.Database.Action.Query.Facet (FacetDoc , runViewDocuments, OrderBy(..), runViewAuthorsDoc)
import Gargantext.Database.Action.Learn (FavOrTrash(..), moreLike)
import Gargantext.Database.Action.Search
import Gargantext.Database.Admin.Types.Node
......
......@@ -41,7 +41,7 @@ import Gargantext.API.Ngrams
import Gargantext.API.Orchestrator.Types
import Gargantext.API.Settings
import Gargantext.Core.Types
import Gargantext.Database.Action.Tree
import Gargantext.Database.Action.Query.Tree
import Gargantext.Database.Admin.Types.Errors (NodeError(..), HasNodeError(..))
import Gargantext.Database.Admin.Utils
import Gargantext.Prelude
......
......@@ -55,10 +55,13 @@ import Gargantext.Core.Types.Individu (User(..))
import Gargantext.Core.Types.Main
import Gargantext.Database.Action.Flow.List
import Gargantext.Database.Action.Flow.Types
import Gargantext.Database.Action.Flow.Utils (insertDocNgrams)
import Gargantext.Database.Action.Flow.Utils (insertDocNgrams, getUserId)
import Gargantext.Database.Action.Query.Node
import Gargantext.Database.Action.Query.User
import Gargantext.Database.Action.Query.Node.Contact -- (HyperdataContact(..), ContactWho(..))
import Gargantext.Database.Action.Query.Node.Document.Insert -- (insertDocuments, ReturnId(..), addUniqIdsDoc, addUniqIdsContact, ToDbData(..))
import Gargantext.Database.Action.Root (getRoot)
import Gargantext.Database.Action.Query.Tree.Root (getRoot)
import Gargantext.Database.Action.Query.Tree (mkRoot)
import Gargantext.Database.Action.Search (searchInDatabase)
import Gargantext.Database.Admin.Config (userMaster, corpusMasterName)
import Gargantext.Database.Admin.Types.Errors (HasNodeError(..), NodeError(..), nodeError)
......@@ -68,7 +71,6 @@ import Gargantext.Database.Schema.Ngrams -- (insertNgrams, Ngrams(..), NgramsInd
import Gargantext.Database.Schema.Node -- (mkRoot, mkCorpus, getOrMkList, mkGraph, {-mkPhylo,-} mkDashboard, mkAnnuaire, getCorporaWithParentId, HasNodeError, NodeError(..), nodeError)
import Gargantext.Database.Schema.NodeNgrams (listInsertDb , getCgramsId)
import Gargantext.Database.Schema.NodeNodeNgrams2 -- (NodeNodeNgrams2, insertNodeNodeNgrams2)
import Gargantext.Database.Schema.User (getUserId)
import Gargantext.Ext.IMT (toSchoolName)
import Gargantext.Ext.IMTUser (deserialiseImtUsersFromFile)
import Gargantext.Prelude
......
......@@ -29,8 +29,8 @@ import Gargantext.Core.Types (TableResult(..))
import Gargantext.Database.Action.Flow.Utils
import Gargantext.Database.Admin.Types.Node (AnnuaireId, CorpusId, ListId{-, DocId, ContactId-})
import Gargantext.Database.Admin.Utils (Cmd, runPGSQuery)
import Gargantext.Database.Node.Children (getAllContacts)
import Gargantext.Database.Node.Contact -- (HyperdataContact(..))
import Gargantext.Database.Action.Query.Node.Children (getAllContacts)
import Gargantext.Database.Action.Query.Node.Contact -- (HyperdataContact(..))
import Gargantext.Database.Schema.Ngrams -- (NgramsType(..))
import Gargantext.Prelude hiding (sum)
import Safe (lastMay)
......
......@@ -18,16 +18,20 @@ module Gargantext.Database.Action.Flow.Utils
where
import Data.Map (Map)
import Gargantext.Core.Types (Name)
import Gargantext.Core.Types.Individu (User(..))
import Gargantext.Database.Action.Query.Node
import Gargantext.Database.Action.Query.User
import Gargantext.Database.Admin.Types.Errors
import Gargantext.Database.Admin.Types.Node
import Gargantext.Database.Admin.Types.Node (NodeId, Node, NodePoly(..), Hyperdata)
import Gargantext.Database.Admin.Utils (Cmd)
import Gargantext.Database.Schema.Ngrams
import Gargantext.Database.Schema.Node
import Gargantext.Database.Schema.User
import Gargantext.Database.Schema.NodeNodeNgrams
import Gargantext.Database.Action.Query.Node (getNode)
import Gargantext.Prelude
import qualified Data.Map as DM
getUserId :: HasNodeError err
=> User
-> Cmd err UserId
......@@ -42,8 +46,6 @@ getUserId (UserName u ) = do
Nothing -> nodeError NoUserFound
toMaps :: Hyperdata a
=> (a -> Map (NgramsT Ngrams) Int)
-> [Node a]
......
......@@ -23,7 +23,7 @@ import Data.Maybe
import Data.Text (Text)
import Data.Tuple (snd)
import Gargantext.Core.Types (Offset, Limit)
import Gargantext.Database.Action.Facet
import Gargantext.Database.Action.Query.Facet
import Gargantext.Database.Admin.Types.Node
import Gargantext.Database.Admin.Utils (Cmd)
import Gargantext.Prelude
......
......@@ -28,7 +28,7 @@ import Gargantext.Database.Action.Metrics.NgramsByNode (getNodesByNgramsOnlyUser
import Gargantext.Database.Action.Query.Node.Select
import Gargantext.Database.Admin.Config (userMaster)
import Gargantext.Database.Admin.Types.Node (ListId, CorpusId{-, HyperdataCorpus-})
import Gargantext.Database.Schema.Node (defaultList)
import Gargantext.Database.Action.Query.Node (defaultList)
import Gargantext.Prelude
import Gargantext.Text.Metrics (scored, Scored(..), {-localMetrics, toScored-})
import qualified Data.Map as Map
......
......@@ -27,12 +27,17 @@ Portability : POSIX
module Gargantext.Database.Action.Query
where
import Gargantext.Core.Types (Name)
import Gargantext.Database.Action.Query.Node
import Gargantext.Database.Action.Query.Node.User
import Gargantext.Database.Action.Query.User
import Gargantext.Database.Admin.Types.Errors
import Gargantext.Database.Admin.Types.Node
import Gargantext.Database.Admin.Utils (Cmd)
import Gargantext.Database.Schema.Node
import Opaleye hiding (FromField)
import Prelude hiding (null, id, map, sum)
------------------------------------------------------------------------
-- | TODO mk all others nodes
mkNodeWithParent :: HasNodeError err
......
......@@ -24,6 +24,7 @@ import Gargantext.Database.Admin.Config
import Gargantext.Database.Admin.Utils
import Gargantext.Database.Schema.Node
import Gargantext.Database.Schema.User
import Gargantext.Database.Action.Query.User
import Gargantext.Database.Action.Query.Node
import Opaleye
......
......@@ -26,7 +26,7 @@ import Gargantext.Prelude
import Gargantext.Database.Schema.Node
import Gargantext.Database.Admin.Types.Node
import Gargantext.Database.Admin.Utils (Cmd, mkCmd)
import Gargantext.Database.Action.Query.Node (pgNodeId)
import Gargantext.Database.Admin.Types.Node (pgNodeId)
updateHyperdata :: ToJSON a => NodeId -> a -> Cmd err Int64
updateHyperdata i h = mkCmd $ \c -> runUpdate_ c (updateHyperdataQuery i h)
......
{-|
Module : Gargantext.Database.Node.User
Module : Gargantext.Database.Action.Query.Node.User
Description : User Node in Gargantext
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
......@@ -15,7 +15,6 @@ Portability : POSIX
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
......@@ -32,8 +31,10 @@ import GHC.Generics (Generic)
import Gargantext.Core (Lang(..))
import Gargantext.Core.Types (Name)
import Gargantext.Core.Types.Individu (Username, arbitraryUsername, User(..), UserId)
import Gargantext.Database.Admin.Types.Node (NodeType(..))
import Gargantext.Database.Action.Query.Node
import Gargantext.Core.Utils.Prefix (unPrefix, unPrefixSwagger)
import Gargantext.Database.Admin.Types.Node (pgNodeId)
import Gargantext.Database.Action.Query.Node.Contact (HyperdataContact, fake_HyperdataContact)
import Gargantext.Database.Admin.Types.Node (Node,Hyperdata, DocumentId, NodeId(..))
import Gargantext.Database.Admin.Utils -- (fromField', Cmd)
......@@ -44,8 +45,6 @@ import Test.QuickCheck (elements)
import Test.QuickCheck.Arbitrary (Arbitrary, arbitrary)
------------------------------------------------------------------------
type NodeUser = Node HyperdataUser
data HyperdataUser =
HyperdataUser { _hu_private :: !(Maybe HyperdataPrivate)
, _hu_shared :: !(Maybe HyperdataContact)
......@@ -136,7 +135,7 @@ $(deriveJSON (unPrefix "_hpu_") ''HyperdataPublic)
-----------------------------------------------------------------
getNodeUser :: NodeId -> Cmd err (Node HyperdataUser)
getNodeUser nId = do
fromMaybe (panic $ "Node does not exist: " <> show nId) . headMay
fromMaybe (panic $ "Node does not exist: " <> (cs $ show nId)) . headMay
<$> runOpaQuery (limit 1 $ selectNode (pgNodeId nId))
......@@ -145,6 +144,3 @@ nodeUserW maybeName maybeHyperdata = node NodeUser name user Nothing
where
name = maybe "User" identity maybeName
user = maybe fake_HyperdataUser identity maybeHyperdata
......@@ -18,15 +18,7 @@ Let a Root Node, return the Tree of the Node as a directed acyclic graph
{-# LANGUAGE RankNTypes #-}
module Gargantext.Database.Action.Query.Tree
( treeDB
, TreeError(..)
, HasTreeError(..)
, dbTree
, toNodeTree
, DbTreeNode
, isDescendantOf
, isIn
) where
where
import Control.Lens (Prism', (#), (^..), at, each, _Just, to)
import Control.Monad.Error.Class (MonadError(throwError))
......@@ -34,15 +26,18 @@ import Data.Map (Map, fromListWith, lookup)
import Data.Text (Text)
import Database.PostgreSQL.Simple
import Database.PostgreSQL.Simple.SqlQQ
import Gargantext.Prelude
import Gargantext.Core.Types.Individu
import Gargantext.Core.Types.Main (NodeTree(..), Tree(..))
import Gargantext.Database.Action.Query.Node
import Gargantext.Database.Admin.Types.Node -- (pgNodeId, NodeType(..))
import Gargantext.Database.Action.Query.User
import Gargantext.Database.Action.Query
import Gargantext.Database.Action.Flow.Utils (getUserId)
import Gargantext.Database.Admin.Config (fromNodeTypeId, nodeTypeId)
import Gargantext.Database.Admin.Types.Node (NodeId, NodeType, DocId, allNodeTypes)
import Gargantext.Database.Admin.Types.Errors
import Gargantext.Database.Admin.Types.Node (NodeId, NodeType, DocId, allNodeTypes)
import Gargantext.Database.Admin.Utils (Cmd, runPGSQuery)
import Gargantext.Database.Action.Query.Node
import Gargantext.Database.Action.Query.User
import Gargantext.Prelude
------------------------------------------------------------------------
-- import Gargantext.Database.Utils (runCmdDev)
......@@ -87,8 +82,6 @@ treeError te = throwError $ _TreeError # te
treeDB :: HasTreeError err => RootId -> [NodeType] -> Cmd err (Tree NodeTree)
treeDB r nodeTypes = toTree =<< (toTreeParent <$> dbTree r nodeTypes)
type RootId = NodeId
type ParentId = NodeId
------------------------------------------------------------------------
toTree :: (MonadError e m, HasTreeError e)
=> Map (Maybe ParentId) [DbTreeNode] -> m (Tree NodeTree)
......
......@@ -33,7 +33,8 @@ import Gargantext.Database.Admin.Config (nodeTypeId)
import Gargantext.Database.Action.Query.Node.User (HyperdataUser)
import Gargantext.Database.Schema.Node (NodeRead)
import Gargantext.Database.Schema.Node (queryNodeTable)
import Gargantext.Database.Schema.User (queryUserTable, UserPoly(..))
import Gargantext.Database.Schema.User (UserPoly(..))
import Gargantext.Database.Action.Query.User (queryUserTable)
import Gargantext.Database.Admin.Types.Node (Node, NodePoly(..), NodeType(NodeUser))
import Gargantext.Database.Admin.Utils (Cmd, runOpaQuery)
import Gargantext.Prelude
......
......@@ -16,7 +16,6 @@ Portability : POSIX
module Gargantext.Database.Action.Search where
--import Gargantext.Database.Node.Contact
import Control.Arrow (returnA)
import Control.Lens ((^.))
import Data.Aeson
......@@ -31,6 +30,7 @@ import Database.PostgreSQL.Simple.ToField
import Gargantext.Core.Types
import Gargantext.Database.Action.Query.Facet
import Gargantext.Database.Action.Query.Join (leftJoin6)
import Gargantext.Database.Action.Query.Node
import Gargantext.Database.Admin.Config (nodeTypeId)
import Gargantext.Database.Admin.Types.Node (NodeType(..))
import Gargantext.Database.Admin.Utils (Cmd, runPGSQuery, runOpaQuery, runCountOpaQuery)
......@@ -43,7 +43,6 @@ import Gargantext.Text.Terms.Mono.Stem.En (stemIt)
import Opaleye hiding (Query, Order)
import qualified Opaleye as O hiding (Order)
------------------------------------------------------------------------
searchInDatabase :: ParentId
-> Text
......
......@@ -63,8 +63,6 @@ pgNodeId = O.pgInt4 . id2int
id2int (NodeId n) = n
------------------------------------------------------------------------
newtype NodeId = NodeId Int
deriving (Show, Read, Generic, Num, Eq, Ord, Enum, ToJSONKey, FromJSONKey, ToJSON, FromJSON)
......@@ -120,7 +118,7 @@ type CorpusId = NodeId
type ListId = NodeId
type DocumentId = NodeId
type DocId = NodeId
type RootId = NodeId
type RootId = NodeId
type MasterCorpusId = CorpusId
type UserCorpusId = CorpusId
......
......@@ -27,7 +27,7 @@ import Data.Maybe
import Gargantext.Prelude
import Gargantext.Core (Lang(..))
import Gargantext.API.Orchestrator.Types (ExternalAPIs(..), externalAPIs)
import Gargantext.Database.Types.Node (HyperdataDocument(..))
import Gargantext.Database.Admin.Types.Node (HyperdataDocument(..))
import qualified Gargantext.Text.Corpus.API.Pubmed as PUBMED
import qualified Gargantext.Text.Corpus.API.Isidore as ISIDORE
......
......@@ -18,7 +18,7 @@ module Gargantext.Text.Corpus.API.Isidore where
import System.FilePath (FilePath())
import Data.Text (Text)
import Gargantext.Core (Lang(..))
import Gargantext.Database.Types.Node (HyperdataDocument(..))
import Gargantext.Database.Admin.Types.Node (HyperdataDocument(..))
import Gargantext.Prelude
import Isidore.Client
import Servant.Client
......
......@@ -24,6 +24,7 @@ import Data.Text (Text)
import GHC.Generics (Generic)
import Gargantext.Core.Types.Main
import Gargantext.Database.Action.Query.Node.Select
import Gargantext.Database.Action.Query.Node
import Gargantext.Database.Admin.Config
import Gargantext.Database.Admin.Types.Node (CorpusId)
import Gargantext.Database.Admin.Utils
......
......@@ -44,15 +44,17 @@ import Gargantext.API.Ngrams.Tools
import Gargantext.API.Orchestrator.Types
import Gargantext.API.Types
import Gargantext.Core.Types.Main
import Gargantext.Database.Config
import Gargantext.Database.Metrics.NgramsByNode (getNodesByNgramsOnlyUser)
import Gargantext.Database.Admin.Config
import Gargantext.Database.Action.Metrics.NgramsByNode (getNodesByNgramsOnlyUser)
import Gargantext.Database.Schema.Ngrams
import Gargantext.Database.Node.Select
import Gargantext.Database.Schema.Node (getNodeWith, getNodeUser, defaultList, insertGraph)
import Gargantext.Database.Types.Errors (HasNodeError)
import Gargantext.Database.Types.Node hiding (node_id) -- (GraphId, ListId, CorpusId, NodeId)
import Gargantext.Database.Node.UpdateOpaleye (updateHyperdata)
import Gargantext.Database.Utils (Cmd)
import Gargantext.Database.Action.Query.Node.Select
import Gargantext.Database.Action.Query.Node
import Gargantext.Database.Action.Query.Node.User
import Gargantext.Database.Schema.Node -- (getNodeWith, getNodeUser, defaultList, insertGraph)
import Gargantext.Database.Admin.Types.Errors (HasNodeError)
import Gargantext.Database.Admin.Types.Node hiding (node_id) -- (GraphId, ListId, CorpusId, NodeId)
import Gargantext.Database.Action.Query.Node.UpdateOpaleye (updateHyperdata)
import Gargantext.Database.Admin.Utils (Cmd)
import Gargantext.Prelude
import qualified Gargantext.Prelude as P
import Gargantext.Viz.Graph
......
......@@ -30,9 +30,8 @@ import qualified Data.ByteString as DB
import qualified Data.ByteString.Lazy as DBL
import Data.Swagger
import Gargantext.API.Types
import Gargantext.Database.Types.Node (PhyloId, ListId, CorpusId)
import Gargantext.Database.Schema.Node (insertNodes, nodePhyloW, getNodePhylo)
import Gargantext.Database.Types.Node -- (NodePhylo(..))
import Gargantext.Database.Action.Query.Node (insertNodes, nodePhyloW, getNodePhylo)
import Gargantext.Database.Admin.Types.Node -- (PhyloId, ListId, CorpusId, UserId, NodeId(..))
import Gargantext.Prelude
import Gargantext.Viz.Phylo
import Gargantext.Viz.Phylo.Main
......
......@@ -28,7 +28,7 @@ import Gargantext.API.Ngrams.Tools (getTermsWith)
import Gargantext.Core.Types
import Gargantext.Database.Action.Flow
import Gargantext.Database.Schema.Ngrams (NgramsType(..))
import Gargantext.Database.Schema.Node (defaultList)
import Gargantext.Database.Action.Query.Node(defaultList)
import Gargantext.Database.Schema.NodeNode (selectDocs)
import Gargantext.Prelude
import Gargantext.Text.Context (TermList)
......
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