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
Christian Merten
haskell-gargantext
Commits
fcdb4e92
Commit
fcdb4e92
authored
Jul 23, 2019
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Node] DocTable API extension (add putDocs, deleteAllDocs)
parent
61e8d712
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
Node.hs
src/Gargantext/API/Node.hs
+19
-4
No files found.
src/Gargantext/API/Node.hs
View file @
fcdb4e92
...
@@ -59,7 +59,7 @@ import Gargantext.Database.Config (nodeTypeId)
...
@@ -59,7 +59,7 @@ import Gargantext.Database.Config (nodeTypeId)
import
Gargantext.Database.Facet
(
FacetDoc
,
runViewDocuments
,
OrderBy
(
..
),
runViewAuthorsDoc
)
import
Gargantext.Database.Facet
(
FacetDoc
,
runViewDocuments
,
OrderBy
(
..
),
runViewAuthorsDoc
)
import
Gargantext.Database.Node.Children
(
getChildren
)
import
Gargantext.Database.Node.Children
(
getChildren
)
import
Gargantext.Database.Schema.Node
(
getNodesWithParentId
,
getNode
,
getNode'
,
deleteNode
,
deleteNodes
,
mkNodeWithParent
,
JSONB
,
HasNodeError
(
..
))
import
Gargantext.Database.Schema.Node
(
getNodesWithParentId
,
getNode
,
getNode'
,
deleteNode
,
deleteNodes
,
mkNodeWithParent
,
JSONB
,
HasNodeError
(
..
))
import
Gargantext.Database.Schema.NodeNode
(
nodesToFavorite
,
nodesToTrash
)
import
Gargantext.Database.Schema.NodeNode
(
nodesToFavorite
,
nodesToTrash
,
emptyTrash
)
import
Gargantext.Database.Tree
(
treeDB
)
import
Gargantext.Database.Tree
(
treeDB
)
import
Gargantext.Database.Types.Node
import
Gargantext.Database.Types.Node
import
Gargantext.Database.Utils
-- (Cmd, CmdM)
import
Gargantext.Database.Utils
-- (Cmd, CmdM)
...
@@ -177,7 +177,7 @@ nodeAPI p uId id
...
@@ -177,7 +177,7 @@ nodeAPI p uId id
-- :<|> getTableNgramsDoc id
-- :<|> getTableNgramsDoc id
:<|>
favApi
id
:<|>
favApi
id
:<|>
d
elDocs
id
:<|>
d
ocsApi
id
:<|>
searchDocs
id
:<|>
searchDocs
id
:<|>
getScatter
id
:<|>
getScatter
id
:<|>
getChart
id
:<|>
getChart
id
...
@@ -217,20 +217,35 @@ instance Arbitrary PostNode where
...
@@ -217,20 +217,35 @@ instance Arbitrary PostNode where
arbitrary
=
elements
[
PostNode
"Node test"
NodeCorpus
]
arbitrary
=
elements
[
PostNode
"Node test"
NodeCorpus
]
------------------------------------------------------------------------
------------------------------------------------------------------------
type
DocsApi
=
Summary
"Docs : Move to
trash
"
type
DocsApi
=
Summary
"Docs : Move to
corpus
"
:>
ReqBody
'[
J
SON
]
Documents
:>
ReqBody
'[
J
SON
]
Documents
:>
Put
'[
J
SON
]
[
Int
]
:<|>
Summary
"Docs : Move to trash"
:>
ReqBody
'[
J
SON
]
Documents
:>
Delete
'[
J
SON
]
[
Int
]
:<|>
Summary
"Docs : Remove all docs"
:>
ReqBody
'[
J
SON
]
[]
:>
Delete
'[
J
SON
]
[
Int
]
:>
Delete
'[
J
SON
]
[
Int
]
data
Documents
=
Documents
{
documents
::
[
NodeId
]}
data
Documents
=
Documents
{
documents
::
[
NodeId
]}
deriving
(
Generic
)
deriving
(
Generic
)
instance
FromJSON
Documents
instance
FromJSON
Documents
instance
ToJSON
Documents
instance
ToJSON
Documents
instance
ToSchema
Documents
instance
ToSchema
Documents
putDocs
::
CorpusId
->
Documents
->
Cmd
err
[
Int
]
putDocs
cId
ds
=
nodesToTrash
$
map
(
\
n
->
(
cId
,
n
,
False
))
$
documents
ds
delDocs
::
CorpusId
->
Documents
->
Cmd
err
[
Int
]
delDocs
::
CorpusId
->
Documents
->
Cmd
err
[
Int
]
delDocs
cId
ds
=
nodesToTrash
$
map
(
\
n
->
(
cId
,
n
,
True
))
$
documents
ds
delDocs
cId
ds
=
nodesToTrash
$
map
(
\
n
->
(
cId
,
n
,
True
))
$
documents
ds
delAllDocs
::
CorpusId
->
Cmd
err
[
Int
]
delAllDocs
cId
=
emptyTrash
cId
docsApi
::
CorpusId
->
GargServer
DocsApi
docsApi
cId
=
putDocs
cId
:<|>
delDocs
cId
:<|>
delAllDocs
cId
------------------------------------------------------------------------
------------------------------------------------------------------------
type
FavApi
=
Summary
" Favorites label"
type
FavApi
=
Summary
" Favorites label"
:>
ReqBody
'[
J
SON
]
Favorites
:>
ReqBody
'[
J
SON
]
Favorites
...
...
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