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
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
Show 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)
...
@@ -55,6 +55,7 @@ import Gargantext.Database.Action.Flow.Pairing (pairing)
import
Gargantext.Database.Query.Facet
(
FacetDoc
,
OrderBy
(
..
))
import
Gargantext.Database.Query.Facet
(
FacetDoc
,
OrderBy
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Database.Query.Table.Node
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.Children
(
getChildren
)
import
Gargantext.Database.Query.Table.Node.UpdateOpaleye
(
updateHyperdata
)
import
Gargantext.Database.Query.Table.Node.UpdateOpaleye
(
updateHyperdata
)
import
Gargantext.Database.Query.Table.Node.User
import
Gargantext.Database.Query.Table.Node.User
...
@@ -144,6 +145,7 @@ type NodeAPI a = Get '[JSON] (Node a)
...
@@ -144,6 +145,7 @@ type NodeAPI a = Get '[JSON] (Node a)
:<|>
"tree"
:>
TreeApi
:<|>
"tree"
:>
TreeApi
:<|>
"phylo"
:>
PhyloAPI
:<|>
"phylo"
:>
PhyloAPI
-- :<|> "add" :> NodeAddAPI
-- :<|> "add" :> NodeAddAPI
:<|>
MoveAPI
-- TODO-ACCESS: check userId CanRenameNode nodeId
-- TODO-ACCESS: check userId CanRenameNode nodeId
-- TODO-EVENTS: NodeRenamed RenameNode or re-use some more general NodeEdited...
-- 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
...
@@ -216,6 +218,7 @@ nodeAPI p uId id' = withAccess (Proxy :: Proxy (NodeAPI a)) Proxy uId (PathNode
:<|>
pieApi
id'
:<|>
pieApi
id'
:<|>
treeApi
id'
:<|>
treeApi
id'
:<|>
phyloAPI
id'
uId
:<|>
phyloAPI
id'
uId
:<|>
moveNode
(
RootId
$
NodeId
uId
)
id'
-- :<|> nodeAddAPI id'
-- :<|> nodeAddAPI id'
-- :<|> postUpload id'
-- :<|> postUpload id'
...
@@ -306,7 +309,7 @@ treeAPI :: NodeId -> GargServer TreeAPI
...
@@ -306,7 +309,7 @@ treeAPI :: NodeId -> GargServer TreeAPI
treeAPI
=
tree
Advanced
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
::
NodeId
->
RenameNode
->
Cmd
err
[
Int
]
rename
nId
(
RenameNode
name'
)
=
U
.
update
(
U
.
Rename
nId
name'
)
rename
nId
(
RenameNode
name'
)
=
U
.
update
(
U
.
Rename
nId
name'
)
...
@@ -315,4 +318,16 @@ putNode :: forall err a. (HasNodeError err, JSONB a, ToJSON a)
...
@@ -315,4 +318,16 @@ putNode :: forall err a. (HasNodeError err, JSONB a, ToJSON a)
->
a
->
a
->
Cmd
err
Int
->
Cmd
err
Int
putNode
n
h
=
fromIntegral
<$>
updateHyperdata
n
h
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
...
@@ -170,8 +170,8 @@ simuTask :: MonadBase IO m
->
Int
->
Int
->
m
()
->
m
()
simuTask
logStatus
cur
total
=
do
simuTask
logStatus
cur
total
=
do
let
m
=
(
10
::
Int
)
^
(
6
::
Int
)
_
<-
liftBase
$
threadDelay
(
m
*
5
)
_
<-
liftBase
$
threadDelay
(
m
*
5
)
where
m
=
(
10
::
Int
)
^
(
6
::
Int
)
let
status
=
JobLog
{
_scst_succeeded
=
Just
cur
let
status
=
JobLog
{
_scst_succeeded
=
Just
cur
,
_scst_failed
=
Just
0
,
_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