]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Flow.hs
[DB] getRootUser function.
[gargantext.git] / src / Gargantext / Database / Flow.hs
1 {-|
2 Module : Gargantext.Database.Flow
3 Description : Database Flow
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10
11
12 add :: Corpus -> [Documents] -> IO Int
13 if new id -> extractNgrams + extract Authors + extract Sources
14 Map (Ngrams, NodeId)
15 insert Ngrams -> NgramsId
16 Map (NgramsId, NodeId) -> insert
17
18 data NgramsType = Sources | Authors | Terms
19
20 nodes_ngrams : column type, column list
21
22
23 documents
24 sources
25 authors
26
27 -}
28
29 {-# LANGUAGE NoImplicitPrelude #-}
30
31 module Gargantext.Database.Flow
32 where
33
34 import Data.Maybe (Maybe(..))
35 import Gargantext.Prelude
36 import Gargantext.Database.Bashql (runCmd')
37 import Gargantext.Database.Node (Cmd(..), getRootUser)
38 import Gargantext.Database.User (getUser, UserLight(..))
39 import Gargantext.Database.Node.Document.Import (insertDocuments)
40
41 flow = do
42 gargantua_id <- runCmd' (getUser "gargantua")
43 -- createUser
44 userNode <- case gargantua_id of
45 Nothing -> panic "no user"
46 Just userId -> runCmd' (getRootUser $ userLight_id userId)
47
48 case userNode of
49 [] -> pure ()
50 _ -> pure ()
51
52 -- getOrMk
53 --rootId <- runCmd' (getNodeWith userId nodeType)
54 {-
55 rootId <- mk NodeUser gargantua_id "Node Gargantua"
56
57 --folderId <- mk Folder parentId (Name "Data") (Descr "All corpora DATA here")
58 folderId <- mk Folder rootId "Data"
59 corpusId <- mk Corpus folderId (Name "WOS") (Descr "WOS database description")
60
61 docs <- parseDocuments WOS "doc/.."
62 ids <- addDocuments corpusId docs
63
64 user_id <- runCmd' (get RootUser "alexandre")
65 -}
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82