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
a3cd87ad
Commit
a3cd87ad
authored
Jan 22, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WIP] update hyperdata.
parent
13b3d633
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
Node.hs
src/Gargantext/API/Node.hs
+21
-9
No files found.
src/Gargantext/API/Node.hs
View file @
a3cd87ad
...
...
@@ -61,6 +61,7 @@ import Gargantext.Database.Facet (FacetDoc, OrderBy(..))
import
Gargantext.Database.Node.Children
(
getChildren
)
import
Gargantext.Database.Schema.Node
(
getNodesWithParentId
,
getNodeWith
,
getNode
,
deleteNode
,
deleteNodes
,
mkNodeWithParent
,
JSONB
,
HasNodeError
(
..
))
import
Gargantext.Database.Schema.NodeNode
(
nodeNodesCategory
)
import
Gargantext.Database.Node.UpdateOpaleye
(
updateHyperdata
)
import
Gargantext.Database.Tree
(
treeDB
)
import
Gargantext.Database.Types.Node
import
Gargantext.Database.Utils
-- (Cmd, CmdM)
...
...
@@ -160,24 +161,27 @@ type ChildrenApi a = Summary " Summary children"
------------------------------------------------------------------------
type
NodeNodeAPI
a
=
Get
'[
J
SON
]
(
Node
a
)
nodeNodeAPI
::
forall
proxy
a
.
(
JSONB
a
,
ToJSON
a
)
=>
proxy
a
->
UserId
->
CorpusId
->
NodeId
->
GargServer
(
NodeNodeAPI
a
)
nodeNodeAPI
::
forall
proxy
a
.
(
JSONB
a
,
ToJSON
a
)
=>
proxy
a
->
UserId
->
CorpusId
->
NodeId
->
GargServer
(
NodeNodeAPI
a
)
nodeNodeAPI
p
uId
cId
nId
=
withAccess
(
Proxy
::
Proxy
(
NodeNodeAPI
a
))
Proxy
uId
(
PathNodeNode
cId
nId
)
nodeNodeAPI'
where
nodeNodeAPI'
::
GargServer
(
NodeNodeAPI
a
)
nodeNodeAPI'
=
getNodeWith
nId
p
------------------------------------------------------------------------
-- TODO: make the NodeId type indexed by `a`, then we no longer need the proxy.
nodeAPI
::
forall
proxy
a
.
(
JSONB
a
,
ToJSON
a
)
=>
proxy
a
->
UserId
->
NodeId
->
GargServer
(
NodeAPI
a
)
nodeAPI
p
uId
id
=
withAccess
(
Proxy
::
Proxy
(
NodeAPI
a
))
Proxy
uId
(
PathNode
id
)
nodeAPI'
where
nodeAPI'
::
GargServer
(
NodeAPI
a
)
nodeAPI'
=
getNodeWith
id
p
nodeAPI'
=
getNodeWith
id
p
:<|>
rename
id
:<|>
postNode
uId
id
:<|>
putNode
id
:<|>
putNode
id
p
:<|>
deleteNodeApi
id
:<|>
getChildren
id
p
...
...
@@ -323,13 +327,21 @@ treeAPI = treeDB
rename
::
NodeId
->
RenameNode
->
Cmd
err
[
Int
]
rename
nId
(
RenameNode
name'
)
=
U
.
update
(
U
.
Rename
nId
name'
)
postNode
::
HasNodeError
err
=>
UserId
->
NodeId
->
PostNode
->
Cmd
err
[
NodeId
]
postNode
::
HasNodeError
err
=>
UserId
->
NodeId
->
PostNode
->
Cmd
err
[
NodeId
]
postNode
uId
pId
(
PostNode
nodeName
nt
)
=
do
nodeUser
<-
getNodeWith
(
NodeId
uId
)
HyperdataUser
let
uId'
=
nodeUser
^.
node_userId
mkNodeWithParent
nt
(
Just
pId
)
uId'
nodeName
putNode
::
NodeId
->
Cmd
err
Int
putNode
=
undefined
-- TODO
putNode
::
forall
err
proxy
a
.
(
HasNodeError
err
,
JSONB
a
,
ToJSON
a
)
=>
NodeId
->
proxy
a
->
Cmd
err
Int
putNode
n
h
=
do
n
<-
fromIntegral
<$>
updateHyperdata
n
h
pure
n
-------------------------------------------------------------
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