Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
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
Przemyslaw Kaminski
haskell-gargantext
Commits
e87b4662
Commit
e87b4662
authored
Jun 23, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] Move node API
parent
eec3bc97
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
8 deletions
+23
-8
Node.hs
src/Gargantext/API/Node.hs
+22
-7
Prelude.hs
src/Gargantext/API/Prelude.hs
+1
-1
No files found.
src/Gargantext/API/Node.hs
View file @
e87b4662
...
...
@@ -55,6 +55,7 @@ import Gargantext.Database.Action.Flow.Pairing (pairing)
import
Gargantext.Database.Query.Facet
(
FacetDoc
,
OrderBy
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Database.Query.Table.Node
import
Gargantext.Database.Query.Table.Node.Update
(
Update
(
..
),
update
)
import
Gargantext.Database.Query.Table.Node.Children
(
getChildren
)
import
Gargantext.Database.Query.Table.Node.UpdateOpaleye
(
updateHyperdata
)
import
Gargantext.Database.Query.Table.Node.User
...
...
@@ -144,6 +145,7 @@ type NodeAPI a = Get '[JSON] (Node a)
:<|>
"tree"
:>
TreeApi
:<|>
"phylo"
:>
PhyloAPI
-- :<|> "add" :> NodeAddAPI
:<|>
MoveAPI
-- TODO-ACCESS: check userId CanRenameNode nodeId
-- TODO-EVENTS: NodeRenamed RenameNode or re-use some more general NodeEdited...
...
...
@@ -216,6 +218,7 @@ nodeAPI p uId id' = withAccess (Proxy :: Proxy (NodeAPI a)) Proxy uId (PathNode
:<|>
pieApi
id'
:<|>
treeApi
id'
:<|>
phyloAPI
id'
uId
:<|>
moveNode
(
RootId
$
NodeId
uId
)
id'
-- :<|> nodeAddAPI id'
-- :<|> postUpload id'
...
...
@@ -271,12 +274,12 @@ catApi = putCat
-- TODO adapt FacetDoc -> ListDoc (and add type of document as column)
-- Pairing utilities to move elsewhere
type
PairingApi
=
Summary
" Pairing API"
:>
QueryParam
"view"
TabType
-- TODO change TabType -> DocType (CorpusId for pairing)
:>
QueryParam
"offset"
Int
:>
QueryParam
"limit"
Int
:>
QueryParam
"order"
OrderBy
:>
Get
'[
J
SON
]
[
FacetDoc
]
:>
QueryParam
"view"
TabType
-- TODO change TabType -> DocType (CorpusId for pairing)
:>
QueryParam
"offset"
Int
:>
QueryParam
"limit"
Int
:>
QueryParam
"order"
OrderBy
:>
Get
'[
J
SON
]
[
FacetDoc
]
----------
type
Pairs
=
Summary
"List of Pairs"
...
...
@@ -306,7 +309,7 @@ treeAPI :: NodeId -> GargServer TreeAPI
treeAPI
=
tree
Advanced
------------------------------------------------------------------------
-- | Check if the name is less than 255 char
-- |
TODO
Check if the name is less than 255 char
rename
::
NodeId
->
RenameNode
->
Cmd
err
[
Int
]
rename
nId
(
RenameNode
name'
)
=
U
.
update
(
U
.
Rename
nId
name'
)
...
...
@@ -315,4 +318,16 @@ putNode :: forall err a. (HasNodeError err, JSONB a, ToJSON a)
->
a
->
Cmd
err
Int
putNode
n
h
=
fromIntegral
<$>
updateHyperdata
n
h
-------------------------------------------------------------
type
MoveAPI
=
Summary
"Move Node endpoint"
:>
Capture
"parent_id"
ParentId
:>
Put
'[
J
SON
]
[
Int
]
moveNode
::
User
->
NodeId
->
ParentId
->
Cmd
err
[
Int
]
moveNode
_u
n
p
=
update
(
Move
n
p
)
-------------------------------------------------------------
src/Gargantext/API/Prelude.hs
View file @
e87b4662
...
...
@@ -170,8 +170,8 @@ simuTask :: MonadBase IO m
->
Int
->
m
()
simuTask
logStatus
cur
total
=
do
let
m
=
(
10
::
Int
)
^
(
6
::
Int
)
_
<-
liftBase
$
threadDelay
(
m
*
5
)
where
m
=
(
10
::
Int
)
^
(
6
::
Int
)
let
status
=
JobLog
{
_scst_succeeded
=
Just
cur
,
_scst_failed
=
Just
0
...
...
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