Commit 5d2c5e8e authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch 'dev' into 131-dev-ngrams-table-db-connection-2

parents a9000891 4e677956
Pipeline #2971 failed with stage
in 29 minutes and 48 seconds
## Version 0.0.5.9
* [FIX] Annuaire Contact Page
* [WIP] Graph Debug (mergeNgrams enabled again)
## Version 0.0.5.8.9.9 ## Version 0.0.5.8.9.9
* [FIX] Debug Graph Labels * [FIX] Debug Graph Labels
* [FIX] schema upgraded, use 0.0.5.7.8.sql to upgrade your database * [FIX] schema upgraded, use 0.0.5.7.8.sql to upgrade your database
* [FEAT] Script to create and sending email to user: invitation
## Version 0.0.5.8.9.8 ## Version 0.0.5.8.9.8
* [ERGO] NgramsTable, change group and search for ngrams to add * [ERGO] NgramsTable, change group and search for ngrams to add
......
{-|
Module : Main.hs
Description : GarganText Mailing Invitations
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
{-# LANGUAGE Strict #-}
module Main where
import Data.Either (Either(..))
import Gargantext.API.Dev (withDevEnv, runCmdDev)
import Gargantext.API.Node () -- instances only
import Gargantext.API.Prelude (GargError)
import Gargantext.Core.Types.Individu (User(..), arbitraryNewUsers, NewUser(..), arbitraryUsername, GargPassword(..))
import Gargantext.Database.Action.Flow (getOrMkRoot, getOrMk_RootWithCorpus)
import Gargantext.Database.Admin.Config (userMaster, corpusMasterName)
import Gargantext.Database.Admin.Trigger.Init (initFirstTriggers, initLastTriggers)
import Gargantext.Database.Admin.Types.Hyperdata (HyperdataCorpus)
import Gargantext.Database.Admin.Types.Node
import Gargantext.Database.Prelude (CmdR)
import Gargantext.Database.Query.Table.Node (getOrMkList)
import Gargantext.Database.Query.Table.User (insertNewUsers, )
import Gargantext.Prelude
import Gargantext.Prelude.Config (GargConfig(..), readConfig)
import Prelude (getLine)
import System.Environment (getArgs)
import Gargantext.Database.Action.User.New (newUsers)
main :: IO ()
main = do
params@[iniPath,email] <- getArgs
_ <- if length params /= 2
then panic "USAGE: ./gargantext-init gargantext.ini student@university.edu"
else pure ()
cfg <- readConfig iniPath
let createUsers :: CmdR GargError Int64
createUsers = newUsers [cs email]
withDevEnv iniPath $ \env -> do
_ <- runCmdDev env createUsers
pure ()
...@@ -17,7 +17,7 @@ CREATE TABLE public.auth_user ( ...@@ -17,7 +17,7 @@ CREATE TABLE public.auth_user (
is_staff BOOLEAN NOT NULL, is_staff BOOLEAN NOT NULL,
is_active BOOLEAN NOT NULL, is_active BOOLEAN NOT NULL,
date_joined TIMESTAMP with time zone DEFAULT now() NOT NULL, date_joined TIMESTAMP with time zone DEFAULT now() NOT NULL,
forgot_password TEXT, forgot_password_uuid TEXT,
PRIMARY KEY (id) PRIMARY KEY (id)
); );
ALTER TABLE public.auth_user OWNER TO gargantua; ALTER TABLE public.auth_user OWNER TO gargantua;
......
...@@ -5,7 +5,7 @@ cabal-version: 1.12 ...@@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack -- see: https://github.com/sol/hpack
name: gargantext name: gargantext
version: 0.0.5.8.9.9 version: 0.0.5.9
synopsis: Search, map, share synopsis: Search, map, share
description: Please see README.md description: Please see README.md
category: Data category: Data
...@@ -709,6 +709,33 @@ executable gargantext-init ...@@ -709,6 +709,33 @@ executable gargantext-init
, text , text
default-language: Haskell2010 default-language: Haskell2010
executable gargantext-invitations
main-is: Main.hs
other-modules:
Paths_gargantext
hs-source-dirs:
bin/gargantext-invitations
default-extensions:
DataKinds
DeriveGeneric
FlexibleContexts
FlexibleInstances
GeneralizedNewtypeDeriving
MultiParamTypeClasses
NamedFieldPuns
NoImplicitPrelude
OverloadedStrings
RankNTypes
RecordWildCards
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -O2 -Wmissing-signatures
build-depends:
base
, extra
, gargantext
, gargantext-prelude
, text
default-language: Haskell2010
executable gargantext-phylo executable gargantext-phylo
main-is: Main.hs main-is: Main.hs
other-modules: other-modules:
......
...@@ -6,7 +6,7 @@ name: gargantext ...@@ -6,7 +6,7 @@ name: gargantext
# | | | +----- Layers * : New versions with API additions # | | | +----- Layers * : New versions with API additions
# | | | | +--- Layers * : New versions without API breaking changes # | | | | +--- Layers * : New versions without API breaking changes
# | | | | | # | | | | |
version: '0.0.5.8.9.9' version: '0.0.5.9'
synopsis: Search, map, share synopsis: Search, map, share
description: Please see README.md description: Please see README.md
category: Data category: Data
...@@ -435,6 +435,21 @@ executables: ...@@ -435,6 +435,21 @@ executables:
- gargantext-prelude - gargantext-prelude
- base - base
gargantext-invitations:
main: Main.hs
source-dirs: bin/gargantext-invitations
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -O2
- -Wmissing-signatures
dependencies:
- gargantext
- gargantext-prelude
- base
gargantext-upgrade: gargantext-upgrade:
main: Main.hs main: Main.hs
source-dirs: bin/gargantext-upgrade source-dirs: bin/gargantext-upgrade
......
...@@ -19,7 +19,7 @@ import Gargantext.Database.Admin.Types.Hyperdata.Contact ...@@ -19,7 +19,7 @@ import Gargantext.Database.Admin.Types.Hyperdata.Contact
, ContactWho , ContactWho
, cw_firstName , cw_firstName
, cw_lastName , cw_lastName
, hc_who) , hc_who, ContactWhere, hc_where, cw_organization, cw_labTeamDepts, cw_role, cw_office, cw_country, cw_city, cw_touch, ct_mail, ct_phone, ct_url, hc_title, hc_source)
import Gargantext.Database.Admin.Types.Node (NodeId(..)) import Gargantext.Database.Admin.Types.Node (NodeId(..))
import Gargantext.Database.Prelude (HasConnectionPool, HasConfig) import Gargantext.Database.Prelude (HasConnectionPool, HasConfig)
import Gargantext.Database.Query.Table.Context (getContextWith) import Gargantext.Database.Query.Table.Context (getContextWith)
...@@ -28,9 +28,20 @@ import Gargantext.Prelude ...@@ -28,9 +28,20 @@ import Gargantext.Prelude
import GHC.Generics (Generic) import GHC.Generics (Generic)
data AnnuaireContact = AnnuaireContact data AnnuaireContact = AnnuaireContact
{ ac_id :: Int { ac_title :: Maybe Text
, ac_source :: Maybe Text
, ac_id :: Int
, ac_firstName :: Maybe Text , ac_firstName :: Maybe Text
, ac_lastName :: Maybe Text , ac_lastName :: Maybe Text
, ac_labTeamDepts :: [Text]
, ac_organization :: [Text]
, ac_role :: Maybe Text
, ac_office :: Maybe Text
, ac_country :: Maybe Text
, ac_city :: Maybe Text
, ac_touchMail :: Maybe Text
, ac_touchPhone :: Maybe Text
, ac_touchUrl :: Maybe Text
} }
deriving (Generic, GQLType, Show) deriving (Generic, GQLType, Show)
...@@ -62,14 +73,48 @@ dbAnnuaireContacts contact_id = do ...@@ -62,14 +73,48 @@ dbAnnuaireContacts contact_id = do
toAnnuaireContact :: (Int, HyperdataContact) -> AnnuaireContact toAnnuaireContact :: (Int, HyperdataContact) -> AnnuaireContact
toAnnuaireContact (c_id, c_hyperdata) = toAnnuaireContact (c_id, c_hyperdata) =
AnnuaireContact { ac_id = c_id AnnuaireContact { ac_title = c_hyperdata ^. ac_titleL
, ac_source = c_hyperdata ^. ac_sourceL
, ac_id = c_id
, ac_firstName = c_hyperdata ^. ac_firstNameL , ac_firstName = c_hyperdata ^. ac_firstNameL
, ac_lastName = c_hyperdata ^. ac_lastNameL } , ac_lastName = c_hyperdata ^. ac_lastNameL
, ac_organization = c_hyperdata ^. ac_organizationL
, ac_labTeamDepts = c_hyperdata ^. ac_labTeamDeptsL
, ac_role = c_hyperdata ^. ac_roleL
, ac_office = c_hyperdata ^. ac_officeL
, ac_country = c_hyperdata ^. ac_countryL
, ac_city = c_hyperdata ^. ac_cityL
, ac_touchMail = c_hyperdata ^. ac_touchMailL
, ac_touchPhone = c_hyperdata ^. ac_touchPhoneL
, ac_touchUrl = c_hyperdata ^. ac_touchUrlL }
ac_titleL :: Traversal' HyperdataContact (Maybe Text)
ac_titleL = hc_title
ac_sourceL :: Traversal' HyperdataContact (Maybe Text)
ac_sourceL = hc_source
contactWhoL :: Traversal' HyperdataContact ContactWho contactWhoL :: Traversal' HyperdataContact ContactWho
contactWhoL = hc_who . _Just contactWhoL = hc_who . _Just
ac_firstNameL :: Traversal' HyperdataContact (Maybe Text) ac_firstNameL :: Traversal' HyperdataContact (Maybe Text)
ac_firstNameL = contactWhoL . cw_firstName ac_firstNameL = contactWhoL . cw_firstName
ac_lastNameL :: Traversal' HyperdataContact (Maybe Text) ac_lastNameL :: Traversal' HyperdataContact (Maybe Text)
ac_lastNameL = contactWhoL . cw_lastName ac_lastNameL = contactWhoL . cw_lastName
contactWhereL :: Traversal' HyperdataContact ContactWhere
contactWhereL = hc_where . ix 0
ac_organizationL :: Traversal' HyperdataContact [Text]
ac_organizationL = contactWhereL . cw_organization
ac_labTeamDeptsL :: Traversal' HyperdataContact [Text]
ac_labTeamDeptsL = contactWhereL . cw_labTeamDepts
ac_roleL :: Traversal' HyperdataContact (Maybe Text)
ac_roleL = contactWhereL . cw_role
ac_officeL :: Traversal' HyperdataContact (Maybe Text)
ac_officeL = contactWhereL . cw_office
ac_countryL :: Traversal' HyperdataContact (Maybe Text)
ac_countryL = contactWhereL . cw_country
ac_cityL :: Traversal' HyperdataContact (Maybe Text)
ac_cityL = contactWhereL . cw_city
ac_touchMailL :: Traversal' HyperdataContact (Maybe Text)
ac_touchMailL = contactWhereL . cw_touch . _Just . ct_mail
ac_touchPhoneL :: Traversal' HyperdataContact (Maybe Text)
ac_touchPhoneL = contactWhereL . cw_touch . _Just . ct_phone
ac_touchUrlL :: Traversal' HyperdataContact (Maybe Text)
ac_touchUrlL = contactWhereL . cw_touch . _Just . ct_url
...@@ -184,11 +184,11 @@ computeGraph cId method d nt repo = do ...@@ -184,11 +184,11 @@ computeGraph cId method d nt repo = do
graph <- liftBase $ cooc2graphWith method d 0 myCooc graph <- liftBase $ cooc2graphWith method d 0 myCooc
-- listNgrams <- getListNgrams [lId] nt listNgrams <- getListNgrams [lId] nt
--let graph' = mergeGraphNgrams graph (Just listNgrams) let graph' = mergeGraphNgrams graph (Just listNgrams)
-- saveAsFileDebug "/tmp/graphWithNodes" graph' -- saveAsFileDebug "/tmp/graphWithNodes" graph'
pure graph pure graph'
defaultGraphMetadata :: HasNodeError err defaultGraphMetadata :: HasNodeError err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment