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
155
Issues
155
List
Board
Labels
Milestones
Merge Requests
8
Merge Requests
8
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
1ae1a49d
Commit
1ae1a49d
authored
Jul 09, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] API to unpublish: ok
parent
bdcd2dde
Pipeline
#940
failed with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
13 deletions
+18
-13
Node.hs
src/Gargantext/API/Node.hs
+2
-3
Share.hs
src/Gargantext/API/Node/Share.hs
+11
-6
Share.hs
src/Gargantext/Database/Action/Share.hs
+5
-4
No files found.
src/Gargantext/API/Node.hs
View file @
1ae1a49d
...
...
@@ -46,7 +46,6 @@ 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
(
..
))
...
...
@@ -145,7 +144,7 @@ type NodeAPI a = Get '[JSON] (Node a)
:<|>
"phylo"
:>
PhyloAPI
-- :<|> "add" :> NodeAddAPI
:<|>
"move"
:>
MoveAPI
:<|>
"unpublish"
:>
Put
'[
J
SON
]
Int
:<|>
"unpublish"
:>
Share
.
Unpublish
-- TODO-ACCESS: check userId CanRenameNode nodeId
-- TODO-EVENTS: NodeRenamed RenameNode or re-use some more general NodeEdited...
...
...
@@ -221,7 +220,7 @@ 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'
:<|>
Share
.
unPublish
id'
------------------------------------------------------------------------
...
...
src/Gargantext/API/Node/Share.hs
View file @
1ae1a49d
...
...
@@ -21,10 +21,12 @@ import Data.Swagger
import
Data.Text
(
Text
)
import
GHC.Generics
(
Generic
)
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Database.Action.Share
(
shareNodeWith
,
ShareNodeWith
(
..
))
import
Gargantext.Database.Action.Share
(
ShareNodeWith
(
..
))
import
Gargantext.Database.Action.Share
as
DB
(
shareNodeWith
,
unPublish
)
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Prelude
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
(
..
))
import
Gargantext.API.Prelude
import
Gargantext.Prelude
import
Servant
import
Test.QuickCheck
(
elements
)
...
...
@@ -52,16 +54,19 @@ api :: HasNodeError err
->
ShareNodeParams
->
Cmd
err
Int
api
nId
(
ShareTeamParams
user
)
=
fromIntegral
<$>
shareNodeWith
(
ShareNodeWith_User
NodeFolderShared
(
UserName
user
))
nId
fromIntegral
<$>
DB
.
shareNodeWith
(
ShareNodeWith_User
NodeFolderShared
(
UserName
user
))
nId
api
nId2
(
SharePublicParams
nId1
)
=
fromIntegral
<$>
shareNodeWith
(
ShareNodeWith_Node
NodeFolderPublic
nId1
)
nId2
fromIntegral
<$>
DB
.
shareNodeWith
(
ShareNodeWith_Node
NodeFolderPublic
nId1
)
nId2
------------------------------------------------------------------------
type
API
=
Summary
" Share Node with username"
:>
ReqBody
'[
J
SON
]
ShareNodeParams
:>
Post
'[
J
SON
]
Int
------------------------------------------------------------------------
type
Unpublish
=
Summary
" Unpublish Node"
:>
Capture
"node_id"
NodeId
:>
Put
'[
J
SON
]
Int
unPublish
::
NodeId
->
GargServer
Unpublish
unPublish
n
=
DB
.
unPublish
n
src/Gargantext/Database/Action/Share.hs
View file @
1ae1a49d
...
...
@@ -87,8 +87,9 @@ delFolderTeam u nId = do
folderSharedId
<-
getFolderId
u
NodeFolderShared
deleteNodeNode
folderSharedId
nId
unPublish
::
HasNodeError
err
=>
User
->
NodeId
->
Cmd
err
Int
unPublish
u
nId
=
do
folderId
<-
getFolderId
u
NodeFolderPublic
deleteNodeNode
folderId
nId
unPublish
::
HasNodeError
err
=>
ParentId
->
NodeId
->
Cmd
err
Int
unPublish
p
n
=
deleteNodeNode
p
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