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.)
16 {-# LANGUAGE NoImplicitPrelude #-}
17 {-# LANGUAGE OverloadedStrings #-}
19 module Gargantext.Database.Config
23 import Data.Text (Text,pack)
24 import Data.Tuple.Extra (swap)
25 import Data.Maybe (fromMaybe)
26 import Data.List (lookup)
28 import Gargantext.Database.Types.Node
29 import Gargantext.Prelude
31 -- TODO put this in config.ini file
32 corpusMasterName :: Text
33 corpusMasterName = "Main"
36 userMaster = "gargantua"
39 userArbitrary = "user1"
41 nodeTypeId :: NodeType -> NodeTypeId
59 -- NodeOccurrences -> 10
78 -- NodeFavorites -> 15
82 -- | Nodes are typed in the database according to a specific ID
84 nodeTypeInv :: [(NodeTypeId, NodeType)]
85 nodeTypeInv = map swap nodeTypes
87 nodeTypes :: [(NodeType, NodeTypeId)]
88 nodeTypes = [ (n, nodeTypeId n) | n <- allNodeTypes ]
90 fromNodeTypeId :: NodeTypeId -> NodeType
91 fromNodeTypeId tId = fromMaybe (panic $ pack $ "Type Id " <> show tId <> " does not exist")
92 (lookup tId nodeTypeInv)