Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
160
Issues
160
List
Board
Labels
Milestones
Merge Requests
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
22b14f56
Commit
22b14f56
authored
Jun 16, 2023
by
Alfredo Di Napoli
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try the hotfix
parent
a444cb30
Pipeline
#4220
failed with stages
in 50 minutes and 15 seconds
Changes
3
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
4 deletions
+30
-4
New.hs
src/Gargantext/API/Node/Corpus/New.hs
+3
-3
Types.hs
src/Gargantext/API/Node/Corpus/Types.hs
+0
-1
Node.hs
src/Gargantext/Database/Query/Table/Node.hs
+27
-0
No files found.
src/Gargantext/API/Node/Corpus/New.hs
View file @
22b14f56
...
...
@@ -56,7 +56,7 @@ import Gargantext.Database.Action.User (getUserId)
import
Gargantext.Database.Admin.Types.Hyperdata
import
Gargantext.Database.Admin.Types.Node
(
CorpusId
,
NodeType
(
..
))
import
Gargantext.Database.Prelude
(
hasConfig
)
import
Gargantext.Database.Query.Table.Node
(
getNodeWith
)
import
Gargantext.Database.Query.Table.Node
(
getNodeWith
,
updateCorpusPubmedAPIKey
)
import
Gargantext.Database.Query.Table.Node.UpdateOpaleye
(
updateHyperdata
)
import
Gargantext.Database.Schema.Node
(
node_hyperdata
)
import
Gargantext.Prelude
...
...
@@ -208,10 +208,10 @@ addToCorpusWithQuery user cid (WithQuery { _wq_query = q
_
->
do
case
datafield
of
Just
(
External
PubMed
)
->
do
Just
(
External
(
Just
PubMed
)
)
->
do
_api_key
<-
view
$
hasConfig
.
gc_pubmed_api_key
printDebug
"[addToCorpusWithQuery] pubmed api key"
_api_key
_
<-
updateCorpusPubmedAPIKey
cid
_api_key
_
<-
updateCorpusPubmedAPIKey
cid
(
Just
_api_key
)
pure
()
_
->
pure
()
markStarted
3
jobHandle
...
...
src/Gargantext/API/Node/Corpus/Types.hs
View file @
22b14f56
...
...
@@ -4,7 +4,6 @@ module Gargantext.API.Node.Corpus.Types where
import
Control.Lens
hiding
(
elements
,
Empty
)
import
Control.Monad.Fail
(
fail
)
import
Control.Monad.Reader
(
MonadReader
)
import
Data.Aeson
import
Data.Aeson.TH
(
deriveJSON
)
import
Data.Monoid
(
mempty
)
...
...
src/Gargantext/Database/Query/Table/Node.hs
View file @
22b14f56
...
...
@@ -29,6 +29,7 @@ import Data.Text (Text)
import
Database.PostgreSQL.Simple.SqlQQ
(
sql
)
import
Opaleye
hiding
(
FromField
)
import
Prelude
hiding
(
null
,
id
,
map
,
sum
)
import
qualified
PUBMED.Types
as
PUBMED
import
Gargantext.Core
import
Gargantext.Core.Types
...
...
@@ -327,6 +328,32 @@ insertNodesWithParent pid ns = insertNodes (set node_parent_id (pgNodeId <$> pid
insertNodesWithParentR
::
Maybe
ParentId
->
[
NodeWrite
]
->
Cmd
err
[
NodeId
]
insertNodesWithParentR
pid
ns
=
insertNodesR
(
set
node_parent_id
(
pgNodeId
<$>
pid
)
<$>
ns
)
getCorpusPubmedAPIKey
::
NodeId
->
Cmd
err
(
Maybe
PUBMED
.
APIKey
)
getCorpusPubmedAPIKey
cId
=
do
res
<-
runPGSQuery
query
params
pure
$
(
\
(
PGS
.
Only
apiKey
)
->
apiKey
)
<$>
head
res
where
query
::
PGS
.
Query
query
=
[
sql
|
SELECT hyperdata -> 'pubmed_api_key'
FROM nodes
WHERE id = ?
|]
params
=
PGS
.
Only
cId
updateCorpusPubmedAPIKey
::
NodeId
->
Maybe
PUBMED
.
APIKey
->
Cmd
err
Int64
updateCorpusPubmedAPIKey
cId
mAPIKey
=
execPGSQuery
query
params
where
query
::
PGS
.
Query
query
=
[
sql
|
UPDATE nodes
SET hyperdata = hyperdata || ?
WHERE id = ?
|]
params
=
(
encode
$
object
[
"pubmed_api_key"
.=
mAPIKey
],
cId
)
------------------------------------------------------------------------
-- TODO
-- currently this function removes the child relation
...
...
delanoe
@anoe
mentioned in commit
0d383903
·
Jun 19, 2023
mentioned in commit
0d383903
mentioned in commit 0d3839031422de6d32f96e17e15cc85fe00fc001
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment