]> Git — Sourcephile - gargantext.git/blob - bin/gargantext-init/Main.hs
[Annuanire][Contact] Route + script.
[gargantext.git] / bin / gargantext-init / Main.hs
1 {-|
2 Module : Main.hs
3 Description : Gargantext Import Corpus
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10 Import a corpus binary.
11
12 -}
13
14 {-# LANGUAGE NoImplicitPrelude #-}
15 {-# LANGUAGE OverloadedStrings #-}
16 {-# LANGUAGE FlexibleContexts #-}
17 {-# LANGUAGE RankNTypes #-}
18 {-# LANGUAGE Strict #-}
19
20 module Main where
21
22 import System.Environment (getArgs)
23 import Gargantext.Prelude
24 import Gargantext.Database.Flow (FlowCmdM, flowCorpusFile, getOrMkRoot)
25 import Gargantext.Text.Corpus.Parsers (FileFormat(..))
26 import Gargantext.Database.Utils (Cmd, )
27 import Gargantext.Database.Types.Node (CorpusId, toHyperdataDocument, RootId)
28 import Gargantext.Database.Schema.User (insertUsersDemo, UserId)
29 import Gargantext.Text.Terms (TermType(..))
30 import Gargantext.Core (Lang(..))
31 import Gargantext.API.Types (GargError)
32 import Gargantext.API.Node () -- instances
33 import Gargantext.API.Settings (withDevEnv, runCmdDev, DevEnv)
34 --import Gargantext.Text.Corpus.Parsers.GrandDebat (readFile, GrandDebatReference(..))
35 import Data.Text (Text)
36 import qualified Data.Text as Text
37 import Control.Monad.IO.Class (liftIO)
38
39 main :: IO ()
40 main = do
41 [iniPath] <- getArgs
42
43 let createUsers :: Cmd GargError Int64
44 createUsers = insertUsersDemo
45
46 let
47 mkRoots :: Cmd GargError (UserId, RootId)
48 mkRoots = getOrMkRoot "user1"
49
50
51 withDevEnv iniPath $ \env -> do
52 _ <- runCmdDev env createUsers
53 _ <- runCmdDev env mkRoots
54 pure ()