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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Grégoire Locqueville
haskell-gargantext
Commits
0253ad6c
Verified
Commit
0253ad6c
authored
Sep 25, 2023
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ngrams] documents from write nodes: add commit after flow
parent
6feaa0ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
13 deletions
+25
-13
New.hs
src/Gargantext/API/Node/Corpus/New.hs
+3
-3
DocumentsFromWriteNodes.hs
src/Gargantext/API/Node/DocumentsFromWriteNodes.hs
+22
-10
No files found.
src/Gargantext/API/Node/Corpus/New.hs
View file @
0253ad6c
...
...
@@ -194,9 +194,9 @@ type AddWithFile = Summary "Add with MultipartData to corpus endpoint"
addToCorpusWithQuery
::
(
FlowCmdM
env
err
m
,
MonadJobStatus
m
,
HasNodeStoryImmediateSaver
env
,
HasNodeArchiveStoryImmediateSaver
env
)
,
MonadJobStatus
m
,
HasNodeStoryImmediateSaver
env
,
HasNodeArchiveStoryImmediateSaver
env
)
=>
User
->
CorpusId
->
WithQuery
...
...
src/Gargantext/API/Node/DocumentsFromWriteNodes.hs
View file @
0253ad6c
...
...
@@ -21,15 +21,20 @@ import Conduit
import
Control.Lens
((
^.
))
import
Data.Aeson
import
Data.Either
(
Either
(
..
),
rights
)
import
Data.List
qualified
as
List
import
Data.Maybe
(
fromMaybe
)
import
Data.Swagger
import
Data.Text
(
Text
)
import
Data.Text
qualified
as
T
import
GHC.Generics
(
Generic
)
import
Gargantext.API.Admin.EnvTypes
(
Env
,
GargJob
(
..
))
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Ngrams
(
commitStatePatch
,
Versioned
(
..
))
import
Gargantext.API.Prelude
(
GargM
,
GargError
)
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core.NodeStory
(
HasNodeStoryImmediateSaver
,
HasNodeArchiveStoryImmediateSaver
,
currentVersion
)
import
Gargantext.Core.Text.Corpus.Parsers.Date
(
split'
)
import
Gargantext.Core.Text.Corpus.Parsers.FrameWrite
import
Gargantext.Core.Text.List.Social
(
FlowSocialListWith
)
import
Gargantext.Core.Text.Terms
(
TermType
(
..
))
...
...
@@ -39,15 +44,13 @@ import Gargantext.Database.Action.Flow.Types (FlowCmdM)
import
Gargantext.Database.Admin.Types.Hyperdata.Document
(
HyperdataDocument
(
..
))
import
Gargantext.Database.Admin.Types.Hyperdata.Frame
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Query.Table.Node
(
getChildrenByType
,
getClosestParentIdByType'
,
getNodeWith
)
import
Gargantext.Database.Query.Table.Node
(
getChildrenByType
,
getClosestParentIdByType'
,
getNodeWith
,
getOrMkList
)
import
Gargantext.Database.Schema.Node
(
node_hyperdata
,
node_name
,
node_date
)
import
Gargantext.Prelude
import
Gargantext.Utils.Jobs
(
serveJobsAPI
,
MonadJobStatus
(
..
))
import
Gargantext.Core.Text.Corpus.Parsers.Date
(
split'
)
import
Protolude
(
mempty
)
import
Servant
import
Text.Read
(
readMaybe
)
import
qualified
Data.List
as
List
import
qualified
Data.Text
as
T
-- import qualified Gargantext.Defaults as Defaults
------------------------------------------------------------------------
...
...
@@ -72,12 +75,16 @@ api uId nId =
serveJobsAPI
DocumentFromWriteNodeJob
$
\
jHandle
p
->
documentsFromWriteNodes
uId
nId
p
jHandle
documentsFromWriteNodes
::
(
HasSettings
env
,
FlowCmdM
env
err
m
,
MonadJobStatus
m
)
=>
UserId
->
NodeId
->
Params
->
JobHandle
m
->
m
()
documentsFromWriteNodes
::
(
HasSettings
env
,
FlowCmdM
env
err
m
,
MonadJobStatus
m
,
HasNodeStoryImmediateSaver
env
,
HasNodeArchiveStoryImmediateSaver
env
)
=>
UserId
->
NodeId
->
Params
->
JobHandle
m
->
m
()
documentsFromWriteNodes
uId
nId
Params
{
selection
,
lang
,
paragraphs
}
jobHandle
=
do
markStarted
2
jobHandle
markProgress
1
jobHandle
...
...
@@ -113,6 +120,11 @@ documentsFromWriteNodes uId nId Params { selection, lang, paragraphs } jobHandle
(
Just
selection
)
jobHandle
listId
<-
getOrMkList
cId
uId
v
<-
currentVersion
listId
_
<-
commitStatePatch
listId
(
Versioned
v
mempty
)
markProgress
1
jobHandle
------------------------------------------------------------------------
...
...
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