]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Config.hs
[TREE] SQL query.
[gargantext.git] / src / Gargantext / Database / 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 All Database related stuff here.
11
12 Target: just import this module and nothing else to work with
13 Gargantext's database.
14
15 -}
16
17 {-# LANGUAGE NoImplicitPrelude #-}
18
19 module Gargantext.Database.Config
20 where
21
22 import Data.Text (pack)
23 import Data.Maybe (fromMaybe)
24 import Data.List (lookup)
25
26 import Gargantext.Database.Types.Node
27 import Gargantext.Prelude
28
29 -- | Nodes are typed in the database according to a specific ID
30 --
31 nodeTypes :: [(NodeType, NodeTypeId)]
32 nodeTypes = [ (NodeUser , 1)
33 , (Folder , 2)
34 , (NodeCorpus , 30)
35 , (Annuaire , 31)
36 , (Document , 4)
37 , (UserPage , 41)
38 --, (NodeSwap , 19)
39 ------ Lists
40 -- , (StopList , 5)
41 -- , (GroupList , 6)
42 -- , (MainList , 7)
43 -- , (MapList ,  8)
44 ---- Scores
45 , (Occurrences , 10)
46 -- , (Cooccurrences , 9)
47 --
48 -- , (Specclusion , 11)
49 -- , (Genclusion , 18)
50 -- , (Cvalue , 12)
51 --
52 -- , (TfidfCorpus , 13)
53 -- , (TfidfGlobal , 14)
54 --
55 -- , (TirankLocal , 16)
56 -- , (TirankGlobal , 17)
57 --
58 ---- Node management
59 , (Favorites , 15)
60 --
61 ]
62 --
63 nodeTypeId :: NodeType -> NodeTypeId
64 nodeTypeId tn = fromMaybe (panic $ pack $ "Typename " <> show tn <> " does not exist")
65 (lookup tn nodeTypes)
66
67
68