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
c32ea704
Commit
c32ea704
authored
Jan 10, 2024
by
Karen Konou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API: URL Share route
parent
030f7dad
Pipeline
#5534
passed with stages
in 135 minutes and 58 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
0 deletions
+40
-0
gargantext.cabal
gargantext.cabal
+1
-0
ShareURL.hs
src/Gargantext/API/Node/ShareURL.hs
+36
-0
Routes.hs
src/Gargantext/API/Routes.hs
+3
-0
No files found.
gargantext.cabal
View file @
c32ea704
...
@@ -74,6 +74,7 @@ library
...
@@ -74,6 +74,7 @@ library
Gargantext.API.Node.Corpus.Update
Gargantext.API.Node.Corpus.Update
Gargantext.API.Node.File
Gargantext.API.Node.File
Gargantext.API.Node.Share
Gargantext.API.Node.Share
Gargantext.API.Node.ShareURL
Gargantext.API.Node.Update
Gargantext.API.Node.Update
Gargantext.API.Prelude
Gargantext.API.Prelude
Gargantext.API.Routes
Gargantext.API.Routes
...
...
src/Gargantext/API/Node/ShareURL.hs
0 → 100644
View file @
c32ea704
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ScopedTypeVariables #-}
module
Gargantext.API.Node.ShareURL
where
import
Data.Text
import
Gargantext.Prelude
import
Gargantext.API.Prelude
import
Servant
import
Gargantext.Core.Types
(
NodeType
,
NodeId
)
import
Gargantext.Database.Prelude
(
HasConfig
(
hasConfig
),
CmdCommon
)
import
Control.Lens.Getter
(
view
)
import
Gargantext.Prelude.Config
(
gc_url
)
import
Gargantext.API.Admin.EnvTypes
(
Env
)
import
Gargantext.API.Errors
(
BackendInternalError
)
type
API
=
Summary
"Fetch URL for sharing a node"
:>
QueryParam
"type"
NodeType
:>
QueryParam
"id"
NodeId
:>
Get
'[
J
SON
]
Text
api
::
ServerT
API
(
GargM
Env
BackendInternalError
)
api
=
getUrl
getUrl
::
(
CmdCommon
env
)
=>
Maybe
NodeType
->
Maybe
NodeId
->
GargM
env
BackendInternalError
Text
getUrl
nt
id
=
do
-- TODO add check that the node is able to be shared (in a shared folder)
case
nt
of
Nothing
->
pure
"Invalid node Type"
Just
t
->
case
id
of
Nothing
->
pure
"Invalid node ID"
Just
i
->
do
url
<-
view
$
hasConfig
.
gc_url
pure
$
url
<>
"/#/share/"
<>
show
t
<>
"/"
<>
show
i
src/Gargantext/API/Routes.hs
View file @
c32ea704
...
@@ -43,6 +43,7 @@ import Gargantext.API.Node.Corpus.Export.Types qualified as CorpusExport
...
@@ -43,6 +43,7 @@ import Gargantext.API.Node.Corpus.Export.Types qualified as CorpusExport
import
Gargantext.API.Node.Corpus.New
qualified
as
New
import
Gargantext.API.Node.Corpus.New
qualified
as
New
import
Gargantext.API.Node.Document.Export
qualified
as
DocumentExport
import
Gargantext.API.Node.Document.Export
qualified
as
DocumentExport
import
Gargantext.API.Node.Document.Export.Types
qualified
as
DocumentExport
import
Gargantext.API.Node.Document.Export.Types
qualified
as
DocumentExport
import
Gargantext.API.Node.ShareURL
qualified
as
ShareURL
import
Gargantext.API.Prelude
import
Gargantext.API.Prelude
import
Gargantext.API.Public
qualified
as
Public
import
Gargantext.API.Public
qualified
as
Public
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
))
...
@@ -222,6 +223,7 @@ type GargPrivateAPI' =
...
@@ -222,6 +223,7 @@ type GargPrivateAPI' =
:<|>
List
.
GETAPI
:<|>
List
.
GETAPI
:<|>
List
.
JSONAPI
:<|>
List
.
JSONAPI
:<|>
List
.
CSVAPI
:<|>
List
.
CSVAPI
:<|>
"shareurl"
:>
ShareURL
.
API
{-
{-
:<|> "wait" :> Summary "Wait test"
:<|> "wait" :> Summary "Wait test"
:> Capture "x" Int
:> Capture "x" Int
...
@@ -305,6 +307,7 @@ serverPrivateGargAPI' authenticatedUser@(AuthenticatedUser userNodeId userId)
...
@@ -305,6 +307,7 @@ serverPrivateGargAPI' authenticatedUser@(AuthenticatedUser userNodeId userId)
:<|>
List
.
getApi
:<|>
List
.
getApi
:<|>
List
.
jsonApi
:<|>
List
.
jsonApi
:<|>
List
.
csvApi
:<|>
List
.
csvApi
:<|>
ShareURL
.
api
-- :<|> waitAPI
-- :<|> waitAPI
...
...
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