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
152
Issues
152
List
Board
Labels
Milestones
Merge Requests
9
Merge Requests
9
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
270350af
Commit
270350af
authored
Jan 11, 2022
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[BDD upgrade] adding Context route
parent
4e9b6f41
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
7 deletions
+74
-7
Client.hs
src/Gargantext/API/Client.hs
+3
-1
Context.hs
src/Gargantext/API/Context.hs
+48
-0
Node.hs
src/Gargantext/API/Node.hs
+4
-4
Routes.hs
src/Gargantext/API/Routes.hs
+19
-2
No files found.
src/Gargantext/API/Client.hs
View file @
270350af
...
...
@@ -66,7 +66,8 @@ putRoots :: Token -> ClientM Int -- not actually implemented in the backend
deleteNodes
::
Token
->
[
NodeId
]
->
ClientM
Int
-- node api
getNode
::
Token
->
NodeId
->
ClientM
(
Node
HyperdataAny
)
getNode
::
Token
->
NodeId
->
ClientM
(
Node
HyperdataAny
)
getContext
::
Token
->
ContextId
->
ClientM
(
Node
HyperdataAny
)
renameNode
::
Token
->
NodeId
->
RenameNode
->
ClientM
[
Int
]
postNode
::
Token
->
NodeId
->
PostNode
->
ClientM
[
NodeId
]
postNodeAsync
::
Token
->
NodeId
->
ClientM
(
JobStatus
'S
a
fe
JobLog
)
...
...
@@ -497,6 +498,7 @@ postAuth
:<|>
killNodeDocumentUploadAsyncJob
:<|>
pollNodeDocumentUploadAsyncJob
:<|>
waitNodeDocumentUploadAsyncJob
:<|>
getContext
:<|>
getCorpus
:<|>
renameCorpus
:<|>
postCorpus
...
...
src/Gargantext/API/Context.hs
0 → 100644
View file @
270350af
{-|
Module : Gargantext.API.Context
Description : Server API
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
module
Gargantext.API.Context
where
import
Data.Aeson
(
FromJSON
,
ToJSON
)
import
Servant
import
Gargantext.API.Admin.Auth
(
withAccess
)
import
Gargantext.API.Admin.Auth.Types
(
PathId
(
..
))
import
Gargantext.API.Prelude
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Prelude
-- (Cmd, CmdM)
import
Gargantext.Database.Query.Table.Context
-------------------------------------------------------------------
-- TODO use Context instead of Node
type
ContextAPI
a
=
Get
'[
J
SON
]
(
Node
a
)
------------------------------------------------------------------------
-- TODO NodeAPI -> ContextAPI
contextAPI
::
forall
proxy
a
.
(
JSONB
a
,
FromJSON
a
,
ToJSON
a
)
=>
proxy
a
->
UserId
->
ContextId
->
GargServer
(
ContextAPI
a
)
contextAPI
p
uId
id'
=
withAccess
(
Proxy
::
Proxy
(
ContextAPI
a
))
Proxy
uId
(
PathNode
id'
)
contextAPI'
where
contextAPI'
::
GargServer
(
ContextAPI
a
)
contextAPI'
=
getContextWith
id'
p
src/Gargantext/API/Node.hs
View file @
270350af
...
...
@@ -40,8 +40,8 @@ import Servant
import
Test.QuickCheck
(
elements
)
import
Test.QuickCheck.Arbitrary
(
Arbitrary
,
arbitrary
)
import
Gargantext.API.Admin.Auth.Types
(
PathId
(
..
))
import
Gargantext.API.Admin.Auth
(
withAccess
)
import
Gargantext.API.Admin.Auth.Types
(
PathId
(
..
))
import
Gargantext.API.Metrics
import
Gargantext.API.Ngrams
(
TableNgramsApi
,
apiNgramsTableCorpus
)
import
Gargantext.API.Ngrams.Types
(
TabType
(
..
))
...
...
@@ -53,6 +53,7 @@ import Gargantext.Core.Types (NodeTableResult)
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Core.Types.Main
(
Tree
,
NodeTree
)
import
Gargantext.Core.Utils.Prefix
(
unPrefix
)
import
Gargantext.Core.Viz.Phylo.Legacy.LegacyAPI
(
PhyloAPI
,
phyloAPI
)
import
Gargantext.Database.Action.Flow.Pairing
(
pairing
)
import
Gargantext.Database.Admin.Types.Hyperdata
import
Gargantext.Database.Admin.Types.Node
...
...
@@ -63,13 +64,12 @@ import Gargantext.Database.Query.Table.Node.Children (getChildren)
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
(
..
))
import
Gargantext.Database.Query.Table.Node.Update
(
Update
(
..
),
update
)
import
Gargantext.Database.Query.Table.Node.UpdateOpaleye
(
updateHyperdata
)
import
Gargantext.Database.Query.Table.NodeNode
import
Gargantext.Database.Query.Table.NodeContext
(
nodeContextsCategory
,
nodeContextsScore
)
import
Gargantext.Database.Query.Table.NodeNode
import
Gargantext.Database.Query.Tree
(
tree
,
TreeMode
(
..
))
import
Gargantext.Prelude
import
Gargantext.Core.Viz.Phylo.Legacy.LegacyAPI
(
PhyloAPI
,
phyloAPI
)
import
qualified
Gargantext.API.Node.DocumentsFromWriteNodes
as
DocumentsFromWriteNodes
import
qualified
Gargantext.API.Node.DocumentUpload
as
DocumentUpload
import
qualified
Gargantext.API.Node.DocumentsFromWriteNodes
as
DocumentsFromWriteNodes
import
qualified
Gargantext.API.Node.FrameCalcUpload
as
FrameCalcUpload
import
qualified
Gargantext.API.Node.Share
as
Share
import
qualified
Gargantext.API.Node.Update
as
Update
...
...
src/Gargantext/API/Routes.hs
View file @
270350af
...
...
@@ -33,6 +33,7 @@ import Servant.Auth.Swagger ()
import
Servant.Job.Async
import
Servant.Swagger.UI
{-
import qualified Gargantext.API.Ngrams.List as List
import qualified Gargantext.API.Node.Contact as Contact
import qualified Gargantext.API.Node.Corpus.Annuaire as Annuaire
...
...
@@ -43,21 +44,31 @@ import qualified Gargantext.API.Node.Document.Export as DocumentExport
import qualified Gargantext.API.Node.Document.Export.Types as DocumentExport
import qualified Gargantext.API.Public as Public
import Gargantext.API.Admin.Auth.Types (AuthRequest, AuthResponse, AuthenticatedUser(..), PathId(..))
-}
import
Gargantext.API.Admin.Auth
(
withAccess
)
import
Gargantext.API.Admin.Auth.Types
(
AuthRequest
,
AuthResponse
,
AuthenticatedUser
(
..
),
PathId
(
..
))
import
Gargantext.API.Admin.FrontEnd
(
FrontEndAPI
)
import
Gargantext.API.Count
(
CountAPI
,
count
,
Query
)
import
qualified
Gargantext.API.GraphQL
as
GraphQL
import
Gargantext.API.Job
(
jobLogInit
)
import
Gargantext.API.Ngrams
(
TableNgramsApi
,
apiNgramsTableDoc
)
import
Gargantext.API.Node
import
Gargantext.API.Context
import
Gargantext.API.Prelude
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Core.Viz.Graph.API
import
Gargantext.Database.Prelude
(
HasConfig
(
..
))
import
Gargantext.Database.Admin.Types.Hyperdata
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Prelude
(
HasConfig
(
..
))
import
Gargantext.Prelude
import
Gargantext.Prelude.Config
(
gc_max_docs_scrapers
)
import
qualified
Gargantext.API.GraphQL
as
GraphQL
import
qualified
Gargantext.API.Ngrams.List
as
List
import
qualified
Gargantext.API.Node.Contact
as
Contact
import
qualified
Gargantext.API.Node.Corpus.Annuaire
as
Annuaire
import
qualified
Gargantext.API.Node.Corpus.Export
as
Export
import
qualified
Gargantext.API.Node.Corpus.Export.Types
as
Export
import
qualified
Gargantext.API.Node.Corpus.New
as
New
import
qualified
Gargantext.API.Public
as
Public
type
GargAPI
=
"api"
:>
Summary
"API "
:>
GargAPIVersion
...
...
@@ -101,6 +112,11 @@ type GargPrivateAPI' =
:>
Capture
"node_id"
NodeId
:>
NodeAPI
HyperdataAny
-- Context endpoint
:<|>
"context"
:>
Summary
"Node endpoint"
:>
Capture
"node_id"
ContextId
:>
ContextAPI
HyperdataAny
-- Corpus endpoints
:<|>
"corpus"
:>
Summary
"Corpus endpoint"
:>
Capture
"corpus_id"
CorpusId
...
...
@@ -220,6 +236,7 @@ serverPrivateGargAPI' :: AuthenticatedUser -> GargServer GargPrivateAPI'
serverPrivateGargAPI'
(
AuthenticatedUser
(
NodeId
uid
))
=
serverGargAdminAPI
:<|>
nodeAPI
(
Proxy
::
Proxy
HyperdataAny
)
uid
:<|>
contextAPI
(
Proxy
::
Proxy
HyperdataAny
)
uid
:<|>
nodeAPI
(
Proxy
::
Proxy
HyperdataCorpus
)
uid
:<|>
nodeNodeAPI
(
Proxy
::
Proxy
HyperdataAny
)
uid
:<|>
CorpusExport
.
getCorpus
-- uid
...
...
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