3 Description : GarganText Mailing Invitations
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
13 {-# LANGUAGE Strict #-}
17 import Gargantext.API.Dev (withDevEnv, runCmdDev)
18 import Gargantext.API.Node () -- instances only
19 import Gargantext.API.Prelude (GargError)
20 import Gargantext.Core.NLP (HasNLPServer)
21 import Gargantext.Core.Types.Individu (User(..))
22 import Gargantext.Database.Admin.Types.Node
23 import Gargantext.Database.Prelude (CmdRandom)
24 import Gargantext.Prelude
25 import Gargantext.Prelude.Config (readConfig)
27 import System.Environment (getArgs)
28 import qualified Gargantext.API.Node.Share as Share
32 params@[iniPath,user,node_id,email] <- getArgs
34 _ <- if length params /= 4
35 then panic "USAGE: ./gargantext-init gargantext.ini username node_id student@university.edu"
38 _cfg <- readConfig iniPath
40 let invite :: (CmdRandom env GargError m, HasNLPServer env) => m Int
41 invite = Share.api (UserName $ cs user) (NodeId $ (read node_id :: Int)) (Share.ShareTeamParams $ cs email)
43 withDevEnv iniPath $ \env -> do
44 _ <- runCmdDev env invite