Commit df392b7a authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch '90-dev-hal-box-fix' of...

Merge branch '90-dev-hal-box-fix' of ssh://gitlab.iscpif.fr:20022/gargantext/haskell-gargantext into 90-dev-hal-box-fix
parents ac7c3653 89114ee3
## Version 0.0.5.6.7
* [BACK] fix limit with MAX_DOCS_SCRAPERS
* [FEAT] Users Password Sugar function : in repl, runCmdReplEasy $ updateUsersPassword ["user@mail.com"]
## Version 0.0.5.6.6 ## Version 0.0.5.6.6
* [BACK] CSV List post and reindex after (for both CSV and JSON) * [BACK] CSV List post and reindex after (for both CSV and JSON)
......
name: gargantext name: gargantext
version: '0.0.5.6.6' version: '0.0.5.6.7'
synopsis: Search, map, share synopsis: Search, map, share
description: Please see README.md description: Please see README.md
category: Data category: Data
......
...@@ -31,10 +31,6 @@ import qualified Gargantext.Core.Text.Corpus.API.Istex as ISTEX ...@@ -31,10 +31,6 @@ import qualified Gargantext.Core.Text.Corpus.API.Istex as ISTEX
import qualified Gargantext.Core.Text.Corpus.API.Pubmed as PUBMED import qualified Gargantext.Core.Text.Corpus.API.Pubmed as PUBMED
import Servant.Client (ClientError) import Servant.Client (ClientError)
-- | TODO put in gargantext.init
default_limit :: Maybe Integer
default_limit = Just 10000
-- | Get External API metadata main function -- | Get External API metadata main function
get :: ExternalAPIs get :: ExternalAPIs
-> Lang -> Lang
...@@ -42,15 +38,15 @@ get :: ExternalAPIs ...@@ -42,15 +38,15 @@ get :: ExternalAPIs
-> Maybe Limit -> Maybe Limit
-- -> IO [HyperdataDocument] -- -> IO [HyperdataDocument]
-> IO (Either ClientError (Maybe Integer, ConduitT () HyperdataDocument IO ())) -> IO (Either ClientError (Maybe Integer, ConduitT () HyperdataDocument IO ()))
get PubMed _la q _l = PUBMED.get q Nothing get PubMed _la q limit = PUBMED.get q limit
--docs <- PUBMED.get q default_limit -- EN only by default --docs <- PUBMED.get q default_limit -- EN only by default
--pure (Just $ fromIntegral $ length docs, yieldMany docs) --pure (Just $ fromIntegral $ length docs, yieldMany docs)
get HAL la q _l = HAL.getC la q Nothing get HAL la q limit = HAL.getC la q limit
get IsTex la q _l = do get IsTex la q limit = do
docs <- ISTEX.get la q default_limit docs <- ISTEX.get la q limit
pure $ Right (Just $ fromIntegral $ length docs, yieldMany docs) pure $ Right (Just $ fromIntegral $ length docs, yieldMany docs)
get Isidore la q _l = do get Isidore la q limit = do
docs <- ISIDORE.get la (fromIntegral <$> default_limit) (Just q) Nothing docs <- ISIDORE.get la (fromIntegral <$> limit) (Just q) Nothing
pure $ Right (Just $ fromIntegral $ length docs, yieldMany docs) pure $ Right (Just $ fromIntegral $ length docs, yieldMany docs)
get _ _ _ _ = undefined get _ _ _ _ = undefined
......
...@@ -27,7 +27,7 @@ import Gargantext.Database.Query.Table.User ...@@ -27,7 +27,7 @@ import Gargantext.Database.Query.Table.User
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Prelude.Crypto.Pass.User (gargPass) import Gargantext.Prelude.Crypto.Pass.User (gargPass)
import Gargantext.Prelude.Mail.Types (MailConfig) import Gargantext.Prelude.Mail.Types (MailConfig)
------------------------------------------------------------------------
------------------------------------------------------------------------ ------------------------------------------------------------------------
newUsers :: (CmdM env err m, MonadRandom m, HasNodeError err, HasMail env) newUsers :: (CmdM env err m, MonadRandom m, HasNodeError err, HasMail env)
=> [EmailAddress] -> m Int64 => [EmailAddress] -> m Int64
...@@ -35,6 +35,18 @@ newUsers us = do ...@@ -35,6 +35,18 @@ newUsers us = do
us' <- mapM newUserQuick us us' <- mapM newUserQuick us
config <- view $ mailSettings config <- view $ mailSettings
newUsers' config us' newUsers' config us'
------------------------------------------------------------------------
updateUsersPassword :: (CmdM env err m, MonadRandom m, HasNodeError err, HasMail env)
=> [EmailAddress] -> m Int64
updateUsersPassword us = do
us' <- mapM newUserQuick us
config <- view $ mailSettings
_ <- mapM (\u -> updateUser (SendEmail True) config u) us'
pure 1
------------------------------------------------------------------------
------------------------------------------------------------------------ ------------------------------------------------------------------------
newUserQuick :: (MonadRandom m) newUserQuick :: (MonadRandom m)
=> Text -> m (NewUser GargPassword) => Text -> m (NewUser GargPassword)
...@@ -44,6 +56,7 @@ newUserQuick n = do ...@@ -44,6 +56,7 @@ newUserQuick n = do
Just (u', _m) -> u' Just (u', _m) -> u'
Nothing -> panic "[G.D.A.U.N.newUserQuick]: Email invalid" Nothing -> panic "[G.D.A.U.N.newUserQuick]: Email invalid"
pure (NewUser u n (GargPassword pass)) pure (NewUser u n (GargPassword pass))
------------------------------------------------------------------------
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- | guessUserName -- | guessUserName
...@@ -68,7 +81,6 @@ newUsers' cfg us = do ...@@ -68,7 +81,6 @@ newUsers' cfg us = do
printDebug "newUsers'" us printDebug "newUsers'" us
pure r pure r
------------------------------------------------------------------------ ------------------------------------------------------------------------
updateUser :: HasNodeError err updateUser :: HasNodeError err
=> SendEmail -> MailConfig -> NewUser GargPassword -> Cmd err Int64 => SendEmail -> MailConfig -> NewUser GargPassword -> Cmd err Int64
updateUser (SendEmail send) cfg u = do updateUser (SendEmail send) cfg u = do
......
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