2 Module : Gargantext.Database
3 Description : Tools for Database
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
10 Target: just import this module and nothing else to work with
11 Gargantext's database.
13 TODO: configure nodes table in Haskell (Config typenames etc.)
17 module Gargantext.Database.Admin.Config
20 import Data.List (lookup)
21 import Data.Maybe (fromMaybe)
22 import Data.Text (Text,pack)
23 import Data.Tuple.Extra (swap)
24 import Gargantext.Database.Admin.Types.Node
25 import Gargantext.Prelude
27 -- TODO put this in config.ini file
28 corpusMasterName :: Text
29 corpusMasterName = "Main"
32 userMaster = "gargantua"
35 userArbitrary = "user1"
37 nodeTypeId :: NodeType -> NodeTypeId
42 NodeFolderPrivate -> 20
43 NodeFolderShared -> 21
45 NodeFolderPublic -> 22
60 -- NodeOccurrences -> 10
80 -- NodeFavorites -> 15
84 -- | Nodes are typed in the database according to a specific ID
86 nodeTypeInv :: [(NodeTypeId, NodeType)]
87 nodeTypeInv = map swap nodeTypes
89 nodeTypes :: [(NodeType, NodeTypeId)]
90 nodeTypes = [ (n, nodeTypeId n) | n <- allNodeTypes ]
92 fromNodeTypeId :: NodeTypeId -> NodeType
93 fromNodeTypeId tId = fromMaybe (panic $ pack $ "Type Id " <> show tId <> " does not exist")
94 (lookup tId nodeTypeInv)