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
195
Issues
195
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
a2db09ac
Commit
a2db09ac
authored
Feb 25, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[API] Node User
parent
b2128170
Pipeline
#752
failed with stage
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
13 deletions
+15
-13
API.hs
src/Gargantext/API.hs
+4
-5
Node.hs
src/Gargantext/API/Node.hs
+5
-6
Bashql.hs
src/Gargantext/Database/Bashql.hs
+2
-0
Node.hs
src/Gargantext/Database/Schema/Node.hs
+4
-2
No files found.
src/Gargantext/API.hs
View file @
a2db09ac
...
...
@@ -367,15 +367,14 @@ serverPrivateGargAPI _ = throwAll' (_ServerError # err401)
-- TODO-SECURITY admin only: withAdmin
-- Question: How do we mark admins?
serverGargAdminAPI
::
GargServer
GargAdminAPI
serverGargAdminAPI
=
roots
:<|>
nodesAPI
serverGargAdminAPI
::
NodeId
->
GargServer
GargAdminAPI
serverGargAdminAPI
n
=
roots
n
:<|>
nodesAPI
serverPrivateGargAPI'
::
AuthenticatedUser
->
GargServer
GargPrivateAPI'
serverPrivateGargAPI'
(
AuthenticatedUser
(
NodeId
uid
))
=
serverGargAdminAPI
=
serverGargAdminAPI
(
NodeId
0
)
:<|>
nodeAPI
(
Proxy
::
Proxy
HyperdataAny
)
uid
:<|>
nodeAPI
(
Proxy
::
Proxy
HyperdataCorpus
)
uid
:<|>
nodeNodeAPI
(
Proxy
::
Proxy
HyperdataAny
)
uid
...
...
src/Gargantext/API/Node.hs
View file @
a2db09ac
...
...
@@ -38,8 +38,6 @@ module Gargantext.API.Node
where
import
Control.Lens
((
^.
))
import
Control.Monad
((
>>
))
import
Control.Monad.IO.Class
(
liftIO
)
import
Data.Aeson
(
FromJSON
,
ToJSON
)
import
Data.Maybe
import
Data.Swagger
...
...
@@ -59,6 +57,7 @@ import Gargantext.Database.Config (nodeTypeId)
import
Gargantext.Database.Flow.Pairing
(
pairing
)
import
Gargantext.Database.Facet
(
FacetDoc
,
OrderBy
(
..
))
import
Gargantext.Database.Node.Children
(
getChildren
)
import
Gargantext.Database.Node.User
(
NodeUser
)
import
Gargantext.Database.Schema.Node
(
getNodesWithParentId
,
getNodeWith
,
getNode
,
deleteNode
,
deleteNodes
,
mkNodeWithParent
,
JSONB
,
HasNodeError
(
..
),
getNodeUser
)
import
Gargantext.Database.Schema.NodeNode
-- (nodeNodesCategory, insertNodeNode, NodeNode(..))
import
Gargantext.Database.Node.UpdateOpaleye
(
updateHyperdata
)
...
...
@@ -94,13 +93,13 @@ nodesAPI ids = deleteNodes ids
-- TODO-EVENTS:
-- PutNode ?
-- TODO needs design discussion.
type
Roots
=
Get
'[
J
SON
]
[
Node
HyperdataAny
]
type
Roots
=
Get
'[
J
SON
]
[
Node
User
]
:<|>
Put
'[
J
SON
]
Int
-- TODO
-- | TODO: access by admin only
roots
::
GargServer
Roots
roots
=
(
liftIO
(
putStrLn
(
"/user"
::
Text
))
>>
getNodesWithParentId
0
Nothing
)
:<|>
pure
(
panic
"not implemented yet"
)
-- TODO use patch map to update what we need
roots
::
NodeId
->
GargServer
Roots
roots
n
=
getNodesWithParentId
n
:<|>
pure
(
panic
"not implemented yet"
)
-- TODO use patch map to update what we need
-------------------------------------------------------------------
-- | Node API Types management
...
...
src/Gargantext/Database/Bashql.hs
View file @
a2db09ac
...
...
@@ -106,8 +106,10 @@ get [] = pure []
get
pwd
=
runOpaQuery
$
selectNodesWithParentID
(
last
pwd
)
-- | Home, need to filter with UserId
{-
home :: Cmd err PWD
home = map _node_id <$> getNodesWithParentId 0 Nothing
-}
-- | ls == get Children
ls
::
PWD
->
Cmd
err
[
Node
HyperdataAny
]
...
...
src/Gargantext/Database/Schema/Node.hs
View file @
a2db09ac
...
...
@@ -333,8 +333,10 @@ getNodesWith parentId _ nodeType maybeOffset maybeLimit =
-- TODO: Why is the second parameter ignored?
-- TODO: Why not use getNodesWith?
getNodesWithParentId
::
NodeId
->
Maybe
Text
->
Cmd
err
[
Node
HyperdataAny
]
getNodesWithParentId
n
_
=
runOpaQuery
$
selectNodesWithParentID
n
getNodesWithParentId
::
(
Hyperdata
a
,
QueryRunnerColumnDefault
PGJsonb
a
)
=>
NodeId
->
Cmd
err
[
Node
a
]
getNodesWithParentId
n
=
runOpaQuery
$
selectNodesWithParentID
n
------------------------------------------------------------------------
getDocumentsV3WithParentId
::
NodeId
->
Cmd
err
[
Node
HyperdataDocumentV3
]
...
...
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