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
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
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
852fae28
Commit
852fae28
authored
Sep 28, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[write nodes] preliminary work for Write node adding to corpus
This is only the endpoint, it does nothing yet.
parent
48b94816
Pipeline
#1897
passed with stage
in 38 minutes and 20 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
0 deletions
+84
-0
Node.hs
src/Gargantext/API/Node.hs
+5
-0
DocumentsFromWriteNodes.hs
src/Gargantext/API/Node/DocumentsFromWriteNodes.hs
+79
-0
No files found.
src/Gargantext/API/Node.hs
View file @
852fae28
...
...
@@ -68,6 +68,7 @@ import Gargantext.Database.Query.Table.NodeNode
import
Gargantext.Database.Query.Tree
(
tree
,
TreeMode
(
..
))
import
Gargantext.Prelude
import
Gargantext.Core.Viz.Phylo.Legacy.LegacyAPI
(
PhyloAPI
,
phyloAPI
)
import
qualified
Gargantext.API.Node.DocumentsFromWriteNodes
as
DocumentsFromWriteNodes
import
qualified
Gargantext.API.Node.Share
as
Share
import
qualified
Gargantext.API.Node.Update
as
Update
import
qualified
Gargantext.API.Search
as
Search
...
...
@@ -157,6 +158,8 @@ type NodeAPI a = Get '[JSON] (Node a)
:<|>
"file"
:>
FileApi
:<|>
"async"
:>
FileAsyncApi
:<|>
"documents-from-write-nodes"
:>
DocumentsFromWriteNodes
.
API
-- TODO-ACCESS: check userId CanRenameNode nodeId
-- TODO-EVENTS: NodeRenamed RenameNode or re-use some more general NodeEdited...
type
RenameApi
=
Summary
" Rename Node"
...
...
@@ -240,6 +243,8 @@ nodeAPI p uId id' = withAccess (Proxy :: Proxy (NodeAPI a)) Proxy uId (PathNode
:<|>
fileApi
uId
id'
:<|>
fileAsyncApi
uId
id'
:<|>
DocumentsFromWriteNodes
.
api
uId
id'
------------------------------------------------------------------------
data
RenameNode
=
RenameNode
{
r_name
::
Text
}
...
...
src/Gargantext/API/Node/DocumentsFromWriteNodes.hs
0 → 100644
View file @
852fae28
{-|
Module : Gargantext.API.Node.DocumentsFromWriteNodes
Description :
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
{-# LANGUAGE MonoLocalBinds #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module
Gargantext.API.Node.DocumentsFromWriteNodes
where
import
Data.Aeson
import
Data.Swagger
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Prelude
(
GargServer
)
import
Gargantext.Database.Action.Flow.Types
(
FlowCmdM
)
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Prelude
import
GHC.Generics
(
Generic
)
import
Servant
import
Servant.Job.Async
(
JobFunction
(
..
),
serveJobsAPI
)
------------------------------------------------------------------------
type
API
=
Summary
" Documents from Write nodes."
:>
AsyncJobs
JobLog
'[
J
SON
]
Params
JobLog
------------------------------------------------------------------------
newtype
Params
=
Params
{
id
::
Int
}
deriving
(
Generic
,
Show
)
instance
FromJSON
Params
where
parseJSON
=
genericParseJSON
defaultOptions
instance
ToJSON
Params
where
toJSON
=
genericToJSON
defaultOptions
instance
ToSchema
Params
------------------------------------------------------------------------
api
::
UserId
->
NodeId
->
GargServer
API
api
uId
nId
=
serveJobsAPI
$
JobFunction
(
\
p
log''
->
let
log'
x
=
do
printDebug
"documents from write nodes"
x
liftBase
$
log''
x
in
documentsFromWriteNodes
uId
nId
p
(
liftBase
.
log'
)
)
documentsFromWriteNodes
::
(
HasSettings
env
,
FlowCmdM
env
err
m
)
=>
UserId
->
NodeId
->
Params
->
(
JobLog
->
m
()
)
->
m
JobLog
documentsFromWriteNodes
uId
nId
p
logStatus
=
do
logStatus
JobLog
{
_scst_succeeded
=
Just
1
,
_scst_failed
=
Just
0
,
_scst_remaining
=
Just
1
,
_scst_events
=
Just
[]
}
_
<-
printDebug
"[documentsFromWriteNodes] inside job, uId"
uId
_
<-
printDebug
"[documentsFromWriteNodes] inside job, nId"
nId
_
<-
printDebug
"[documentsFromWriteNodes] inside job, p"
p
pure
JobLog
{
_scst_succeeded
=
Just
2
,
_scst_failed
=
Just
0
,
_scst_remaining
=
Just
0
,
_scst_events
=
Just
[]
}
------------------------------------------------------------------------
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