]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Admin/Config.hs
[FEAT|COLLABORATION] Shared node implemented (TODO Share with api).
[gargantext.git] / src / Gargantext / Database / Admin / Config.hs
1 {-|
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
8 Portability : POSIX
9
10 Target: just import this module and nothing else to work with
11 Gargantext's database.
12
13 TODO: configure nodes table in Haskell (Config typenames etc.)
14 -}
15
16
17 module Gargantext.Database.Admin.Config
18 where
19
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
26
27 -- TODO put this in config.ini file
28 corpusMasterName :: Text
29 corpusMasterName = "Main"
30
31 userMaster :: Text
32 userMaster = "gargantua"
33
34 userArbitrary :: Text
35 userArbitrary = "user1"
36
37 nodeTypeId :: NodeType -> NodeTypeId
38 nodeTypeId n =
39 case n of
40 NodeUser -> 1
41 NodeFolder -> 2
42 NodeFolderPrivate -> 20
43 NodeFolderShared -> 21
44 NodeTeam -> 210
45 NodeFolderPublic -> 22
46 NodeCorpusV3 -> 3
47 NodeCorpus -> 30
48 NodeAnnuaire -> 31
49 NodeTexts -> 40
50 NodeDocument -> 4
51 NodeContact -> 41
52 --NodeSwap -> 19
53
54 ---- Lists
55 NodeList -> 5
56 NodeListCooc -> 50
57 NodeListModel -> 52
58
59 ---- Scores
60 -- NodeOccurrences -> 10
61 NodeGraph -> 9
62 NodePhylo -> 90
63 NodeChart -> 7
64 NodeDashboard -> 71
65 NodeNoteBook -> 88
66
67 -- Cooccurrences -> 9
68 --
69 -- Specclusion -> 11
70 -- Genclusion -> 18
71 -- Cvalue -> 12
72 --
73 -- TfidfCorpus -> 13
74 -- TfidfGlobal -> 14
75 --
76 -- TirankLocal -> 16
77 -- TirankGlobal -> 17
78
79 -- Node management
80 -- NodeFavorites -> 15
81
82
83 --
84 -- | Nodes are typed in the database according to a specific ID
85 --
86 nodeTypeInv :: [(NodeTypeId, NodeType)]
87 nodeTypeInv = map swap nodeTypes
88
89 nodeTypes :: [(NodeType, NodeTypeId)]
90 nodeTypes = [ (n, nodeTypeId n) | n <- allNodeTypes ]
91
92 fromNodeTypeId :: NodeTypeId -> NodeType
93 fromNodeTypeId tId = fromMaybe (panic $ pack $ "Type Id " <> show tId <> " does not exist")
94 (lookup tId nodeTypeInv)
95