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
da90f04c
Commit
da90f04c
authored
Jul 08, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT PUBLIC] fix API
parent
f58dad0d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
Node.hs
src/Gargantext/API/Node.hs
+4
-0
Share.hs
src/Gargantext/API/Node/Share.hs
+8
-2
Share.hs
src/Gargantext/Database/Action/Share.hs
+1
-1
No files found.
src/Gargantext/API/Node.hs
View file @
da90f04c
...
...
@@ -46,6 +46,7 @@ import Gargantext.Core.Types (NodeTableResult)
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Core.Types.Main
(
Tree
,
NodeTree
)
import
Gargantext.Database.Action.Flow.Pairing
(
pairing
)
import
Gargantext.Database.Action.Share
(
unPublish
)
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Prelude
-- (Cmd, CmdM)
import
Gargantext.Database.Query.Facet
(
FacetDoc
,
OrderBy
(
..
))
...
...
@@ -144,6 +145,7 @@ type NodeAPI a = Get '[JSON] (Node a)
:<|>
"phylo"
:>
PhyloAPI
-- :<|> "add" :> NodeAddAPI
:<|>
"move"
:>
MoveAPI
:<|>
"unpublish"
:>
Post
'[
J
SON
]
Int
-- TODO-ACCESS: check userId CanRenameNode nodeId
-- TODO-EVENTS: NodeRenamed RenameNode or re-use some more general NodeEdited...
...
...
@@ -219,6 +221,8 @@ nodeAPI p uId id' = withAccess (Proxy :: Proxy (NodeAPI a)) Proxy uId (PathNode
:<|>
moveNode
(
RootId
$
NodeId
uId
)
id'
-- :<|> nodeAddAPI id'
-- :<|> postUpload id'
:<|>
unPublish
(
RootId
$
NodeId
uId
)
id'
------------------------------------------------------------------------
data
RenameNode
=
RenameNode
{
r_name
::
Text
}
...
...
src/Gargantext/API/Node/Share.hs
View file @
da90f04c
...
...
@@ -36,8 +36,10 @@ data ShareNode = ShareTeam { username :: Text }
deriving
(
Generic
)
------------------------------------------------------------------------
-- TODO unPrefix "pn_" FromJSON, ToJSON, ToSchema, adapt frontend.
instance
FromJSON
ShareNode
instance
ToJSON
ShareNode
instance
FromJSON
ShareNode
where
parseJSON
=
genericParseJSON
(
defaultOptions
{
sumEncoding
=
ObjectWithSingleField
})
instance
ToJSON
ShareNode
where
toJSON
=
genericToJSON
(
defaultOptions
{
sumEncoding
=
ObjectWithSingleField
})
instance
ToSchema
ShareNode
instance
Arbitrary
ShareNode
where
arbitrary
=
elements
[
ShareTeam
"user1"
...
...
@@ -59,3 +61,7 @@ type API = Summary " Share Node with username"
:>
ReqBody
'[
J
SON
]
ShareNode
:>
Post
'[
J
SON
]
Int
src/Gargantext/Database/Action/Share.hs
View file @
da90f04c
...
...
@@ -65,6 +65,7 @@ getFolderId u nt = do
Nothing
->
panic
"No folder shared found"
Just
f
->
pure
(
_node_id
f
)
------------------------------------------------------------------------
type
TeamId
=
NodeId
delFolderTeam
::
User
->
TeamId
->
Cmd
err
Int
...
...
@@ -77,4 +78,3 @@ unPublish u nId = do
folderId
<-
getFolderId
u
NodeFolderPublic
deleteNodeNode
folderId
nId
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