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
191
Issues
191
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
b3224bee
Verified
Commit
b3224bee
authored
Jun 16, 2025
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 477-dev-flow-zip-file-upload-2
parents
44615be8
70edc60b
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
67 additions
and
253 deletions
+67
-253
Routes.hs
bin/gargantext-cli/CLI/Server/Routes.hs
+2
-2
update-project-dependencies
bin/update-project-dependencies
+1
-1
cabal.project
cabal.project
+1
-1
gargantext.cabal
gargantext.cabal
+0
-4
Count.hs
src/Gargantext/API/Count.hs
+0
-33
Types.hs
src/Gargantext/API/Count/Types.hs
+0
-142
List.hs
src/Gargantext/API/Ngrams/List.hs
+7
-4
Node.hs
src/Gargantext/API/Node.hs
+18
-19
Corpus.hs
src/Gargantext/API/Routes/Named/Corpus.hs
+1
-1
Count.hs
src/Gargantext/API/Routes/Named/Count.hs
+0
-18
Private.hs
src/Gargantext/API/Routes/Named/Private.hs
+10
-14
Remote.hs
src/Gargantext/API/Routes/Named/Remote.hs
+17
-9
Share.hs
src/Gargantext/API/Routes/Named/Share.hs
+1
-1
Search.hs
src/Gargantext/API/Search.hs
+1
-1
Private.hs
src/Gargantext/API/Server/Named/Private.hs
+0
-2
stack.yaml
stack.yaml
+1
-1
Instances.hs
test/Test/Instances.hs
+7
-0
No files found.
bin/gargantext-cli/CLI/Server/Routes.hs
View file @
b3224bee
...
...
@@ -14,8 +14,8 @@ import Data.Aeson.Encode.Pretty
import
Data.ByteString
qualified
as
B
import
Data.ByteString.Lazy
qualified
as
BL
import
Gargantext.API.Routes.Named
import
Gargantext.Prelude
import
Options.Applicative
import
Prelude
import
Servant.API
import
Servant.API.Routes
import
Servant.API.WebSocket
qualified
as
WS
(
WebSocketPending
)
...
...
@@ -52,6 +52,6 @@ instance HasRoutes Raw where
routesCLI
::
CLIRoutes
->
IO
()
routesCLI
=
\
case
CLIR_list
->
printRoutes
@
(
NamedRoutes
API
)
->
printRoutes
Sorted
@
(
NamedRoutes
API
)
(
CLIR_export
filePath
)
->
B
.
writeFile
filePath
.
BL
.
toStrict
$
encodePretty
(
getRoutes
@
(
NamedRoutes
API
))
bin/update-project-dependencies
View file @
b3224bee
...
...
@@ -16,7 +16,7 @@ fi
# with the `sha256sum` result calculated on the `cabal.project` and
# `cabal.project.freeze`. This ensures the files stay deterministic so that CI
# cache can kick in.
expected_cabal_project_hash
=
"
20ddb87d1738f617e78a0c9ff29b6bf30efd6beec098fae380eb89bcc43f2135
"
expected_cabal_project_hash
=
"
eb8fdb1a14aa2f7a13f565cf7fa9f6ab0e2dab9212538aed0db5691015be286b
"
expected_cabal_project_freeze_hash
=
"553b98aadb35506a305bd740cdd71f5fadc1e6d55d10f91cf39daa6735a63d78"
...
...
cabal.project
View file @
b3224bee
...
...
@@ -146,7 +146,7 @@ source-repository-package
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
fpringle
/
servant
-
routes
.
git
tag
:
7694f62
af6bc1596d754b42af16da131ac403b3a
tag
:
c3c558d9278ef239a474f1e1b69afc461be60d01
source
-
repository
-
package
type
:
git
...
...
gargantext.cabal
View file @
b3224bee
...
...
@@ -120,7 +120,6 @@ library
Gargantext.API.Admin.Orchestrator.Types
Gargantext.API.Admin.Settings
Gargantext.API.Auth.PolicyCheck
Gargantext.API.Count.Types
Gargantext.API.Dev
Gargantext.API.Errors
Gargantext.API.Errors.Class
...
...
@@ -166,7 +165,6 @@ library
Gargantext.API.Routes.Named.Contact
Gargantext.API.Routes.Named.Context
Gargantext.API.Routes.Named.Corpus
Gargantext.API.Routes.Named.Count
Gargantext.API.Routes.Named.Document
Gargantext.API.Routes.Named.EKG
Gargantext.API.Routes.Named.File
...
...
@@ -335,7 +333,6 @@ library
Gargantext.API.Admin.Auth
Gargantext.API.Admin.FrontEnd
Gargantext.API.Context
Gargantext.API.Count
Gargantext.API.EKG
Gargantext.API.GraphQL
Gargantext.API.GraphQL.Annuaire
...
...
@@ -708,7 +705,6 @@ executable gargantext
, gargantext
, gargantext-prelude
, haskell-bee
, lens >= 5.2.2 && < 5.3
, MonadRandom ^>= 0.6
, optparse-applicative
, postgresql-simple >= 0.6.4 && <= 0.7.0.0
...
...
src/Gargantext/API/Count.hs
deleted
100644 → 0
View file @
44615be8
{-|
Module : Gargantext.API.Count
Description : Server API
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
Count API part of Gargantext.
-}
{-# OPTIONS_GHC -fno-warn-deprecations #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DeriveAnyClass #-}
module
Gargantext.API.Count
(
countAPI
)
where
import
Gargantext.API.Count.Types
import
Gargantext.API.Routes.Named.Count
qualified
as
Named
import
Gargantext.Prelude
import
Servant.Server.Generic
(
AsServerT
)
-----------------------------------------------------------------------
-- TODO-ACCESS: CanCount
-- TODO-EVENTS: No events as this is a read only query.
-----------------------------------------------------------------------
countAPI
::
Query
->
Named
.
CountAPI
(
AsServerT
m
)
countAPI
_
=
Named
.
CountAPI
undefined
src/Gargantext/API/Count/Types.hs
deleted
100644 → 0
View file @
44615be8
{-|
Module : Gargantext.API.Count.Types
Description :
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
{-# LANGUAGE TemplateHaskell #-}
module
Gargantext.API.Count.Types
(
Scraper
(
..
)
,
QueryBool
(
..
)
,
Query
(
..
)
,
Message
(
..
)
,
Code
,
Error
,
Errors
,
Counts
(
..
)
,
Count
(
..
)
-- * functions
,
scrapers
)
where
import
Data.Swagger
(
ToSchema
(
..
),
genericDeclareNamedSchema
)
import
Data.Text
(
pack
)
import
Gargantext.Core.Utils.Prefix
(
unPrefix
,
unPrefixSwagger
)
import
Gargantext.Prelude
import
Test.QuickCheck
(
elements
)
import
Test.QuickCheck.Arbitrary
(
Arbitrary
(
..
))
-----------------------------------------------------------------------
data
Scraper
=
Pubmed
|
Hal
|
IsTex
|
Isidore
deriving
(
Eq
,
Show
,
Generic
,
Enum
,
Bounded
)
scrapers
::
[
Scraper
]
scrapers
=
[
minBound
..
maxBound
]
instance
FromJSON
Scraper
instance
ToJSON
Scraper
instance
Arbitrary
Scraper
where
arbitrary
=
elements
scrapers
instance
ToSchema
Scraper
-----------------------------------------------------------------------
data
QueryBool
=
QueryBool
Text
deriving
(
Eq
,
Show
,
Generic
)
queries
::
[
QueryBool
]
queries
=
[
QueryBool
(
pack
"(X OR X') AND (Y OR Y') NOT (Z OR Z')"
)]
--queries = [QueryBool (pack "(X + X') * (Y + Y') - (Z + Z')")]
instance
Arbitrary
QueryBool
where
arbitrary
=
elements
queries
instance
FromJSON
QueryBool
instance
ToJSON
QueryBool
instance
ToSchema
QueryBool
-----------------------------------------------------------------------
data
Query
=
Query
{
query_query
::
QueryBool
,
query_name
::
Maybe
[
Scraper
]
}
deriving
(
Eq
,
Show
,
Generic
)
instance
FromJSON
Query
instance
ToJSON
Query
instance
Arbitrary
Query
where
arbitrary
=
elements
[
Query
q
(
Just
n
)
|
q
<-
queries
,
n
<-
take
10
$
permutations
scrapers
]
instance
ToSchema
Query
where
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
"query_"
)
-----------------------------------------------------------------------
type
Code
=
Integer
type
Error
=
Text
type
Errors
=
[
Error
]
-----------------------------------------------------------------------
data
Message
=
Message
Code
Errors
deriving
(
Eq
,
Show
,
Generic
)
toMessage
::
[(
Code
,
Errors
)]
->
[
Message
]
toMessage
=
map
(
\
(
c
,
err
)
->
Message
c
err
)
messages
::
[
Message
]
messages
=
toMessage
$
[
(
400
,
[
"Ill formed query "
])
,
(
300
,
[
"API connexion error "
])
,
(
300
,
[
"Internal Gargantext Error "
])
]
<>
take
10
(
repeat
(
200
,
[
""
]))
instance
Arbitrary
Message
where
arbitrary
=
elements
messages
instance
ToSchema
Message
-----------------------------------------------------------------------
data
Counts
=
Counts
{
results
::
[
Either
Message
Count
]
}
deriving
(
Eq
,
Show
,
Generic
)
instance
Arbitrary
Counts
where
arbitrary
=
elements
[
Counts
[
Right
(
Count
Pubmed
(
Just
20
))
,
Right
(
Count
IsTex
(
Just
150
))
,
Right
(
Count
Hal
(
Just
150
))
]
]
instance
ToSchema
Counts
-----------------------------------------------------------------------
data
Count
=
Count
{
count_name
::
Scraper
,
count_count
::
Maybe
Int
}
deriving
(
Eq
,
Show
,
Generic
)
instance
ToSchema
Count
where
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
"count_"
)
--instance Arbitrary Count where
-- arbitrary = Count <$> arbitrary <*> arbitrary <*> arbitrary
--
-- JSON instances
--
instance
FromJSON
Message
instance
ToJSON
Message
$
(
deriveJSON
(
unPrefix
"count_"
)
''
C
ount
)
instance
FromJSON
Counts
instance
ToJSON
Counts
src/Gargantext/API/Ngrams/List.hs
View file @
b3224bee
...
...
@@ -61,10 +61,13 @@ import Servant.Server.Generic (AsServerT)
getAPI
::
Named
.
GETAPI
(
AsServerT
(
GargM
Env
BackendInternalError
))
getAPI
=
Named
.
GETAPI
$
\
listId
->
Named
.
ListEndpoints
{
listJSONEp
=
getJson
listId
,
listJSONZipEp
=
getJsonZip
listId
,
listTSVEp
=
getTsv
listId
getAPI
=
Named
.
GETAPI
{
getListEp
=
\
listId
->
Named
.
ListEndpoints
{
listJSONEp
=
getJson
listId
,
listJSONZipEp
=
getJsonZip
listId
,
listTSVEp
=
getTsv
listId
}
}
--
...
...
src/Gargantext/API/Node.hs
View file @
b3224bee
...
...
@@ -32,7 +32,7 @@ import Gargantext.API.Admin.Auth.Types (PathId(..), AuthenticatedUser (..), auth
import
Gargantext.API.Admin.EnvTypes
(
Env
)
import
Gargantext.API.Auth.PolicyCheck
(
nodeReadChecks
,
nodeWriteChecks
,
moveChecks
,
AccessPolicyManager
,
publishChecks
)
import
Gargantext.API.Errors.Types
(
BackendInternalError
)
import
Gargantext.API.Metrics
import
Gargantext.API.Metrics
(
chartApi
,
pieApi
,
scatterApi
,
treeApi
,
updateChart
)
import
Gargantext.API.Ngrams.Types
(
TabType
(
..
))
import
Gargantext.API.Node.DocumentUpload
qualified
as
DocumentUpload
import
Gargantext.API.Node.DocumentsFromWriteNodes
qualified
as
DFWN
...
...
@@ -40,7 +40,7 @@ import Gargantext.API.Node.File ( fileApi, fileAsyncApi )
import
Gargantext.API.Node.FrameCalcUpload
qualified
as
FrameCalcUpload
import
Gargantext.API.Node.New
(
postNode
,
postNodeAsyncAPI
)
import
Gargantext.API.Node.Share
qualified
as
Share
import
Gargantext.API.Node.Types
import
Gargantext.API.Node.Types
(
NodesToCategory
(
..
),
NodesToScore
(
..
),
RenameNode
(
..
))
import
Gargantext.API.Node.Update
qualified
as
Update
import
Gargantext.API.Prelude
(
GargM
,
GargServer
,
IsGargServer
)
import
Gargantext.API.Routes.Named.File
qualified
as
Named
...
...
@@ -61,14 +61,14 @@ import Gargantext.Database.Action.Delete qualified as Action (deleteNode)
import
Gargantext.Database.Action.Flow.Pairing
(
pairing
)
import
Gargantext.Database.Admin.Types.Hyperdata
(
HyperdataAny
,
HyperdataCorpus
,
HyperdataAnnuaire
)
import
Gargantext.Database.Admin.Types.Hyperdata.Prelude
(
HyperdataC
)
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Prelude
import
Gargantext.Database.Query.Table.Node
import
Gargantext.Database.Admin.Types.Node
(
CorpusId
,
NodeId
,
ParentId
,
RootId
,
UserId
)
import
Gargantext.Database.Prelude
(
DBCmdExtra
,
JSONB
,
runDBTx
,
runDBQuery
)
import
Gargantext.Database.Query.Table.Node
(
defaultList
,
deleteNodes
,
getNodeWith
,
getNodesWithParentId
)
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.Update
qualified
as
U
(
update
,
Update
(
..
),
publish
)
import
Gargantext.Database.Query.Table.Node.UpdateOpaleye
(
updateHyperdata
)
import
Gargantext.Database.Query.Table.Node.Update
qualified
as
U
(
update
,
Update
(
..
),
publish
)
import
Gargantext.Database.Query.Table.Node.Update
(
Update
(
..
),
update
)
import
Gargantext.Database.Query.Table.NodeContext
(
nodeContextsCategory
,
nodeContextsScore
)
import
Gargantext.Database.Query.Table.NodeNode
import
Gargantext.Database.Query.Tree
(
tree
,
tree_flat
,
TreeMode
(
..
))
...
...
@@ -249,11 +249,11 @@ genericNodeAPI' :: forall a proxy. ( HyperdataC a )
->
Named
.
NodeAPI
a
(
AsServerT
(
GargM
Env
BackendInternalError
))
genericNodeAPI'
_
authenticatedUser
targetNode
=
Named
.
NodeAPI
{
nodeNodeAPI
=
withNamedPolicyT
authenticatedUser
(
nodeReadChecks
targetNode
)
$
Named
.
NodeNodeAPI
$
runDBQuery
(
getNodeWith
targetNode
(
Proxy
::
Proxy
a
))
Named
.
NodeNodeAPI
{
getNodeEp
=
runDBQuery
$
getNodeWith
targetNode
(
Proxy
::
Proxy
a
)
}
,
renameAPI
=
withNamedPolicyT
authenticatedUser
(
nodeWriteChecks
targetNode
)
$
Named
.
RenameAPI
$
rename
loggedInUserId
targetNode
Named
.
RenameAPI
{
renameEp
=
rename
loggedInUserId
targetNode
}
,
postNodeAPI
=
withNamedPolicyT
authenticatedUser
(
nodeWriteChecks
targetNode
)
$
Named
.
PostNodeAPI
$
postNode
authenticatedUser
targetNode
Named
.
PostNodeAPI
{
postWithParentEp
=
postNode
authenticatedUser
targetNode
}
,
postNodeAsyncAPI
=
withNamedPolicyT
authenticatedUser
(
nodeWriteChecks
targetNode
)
$
postNodeAsyncAPI
authenticatedUser
targetNode
,
frameCalcUploadAPI
=
FrameCalcUpload
.
api
authenticatedUser
targetNode
...
...
@@ -262,30 +262,29 @@ genericNodeAPI' _ authenticatedUser targetNode = Named.NodeAPI
Update
.
api
targetNode
,
deleteEp
=
withPolicy
authenticatedUser
(
nodeWriteChecks
targetNode
)
$
Action
.
deleteNode
userRootId
targetNode
,
childrenAPI
=
Named
.
ChildrenAPI
$
\
mb_nty
mb_off
mb_lim
->
runDBQuery
$
getChildren
targetNode
(
Proxy
::
Proxy
a
)
mb_nty
mb_off
mb_lim
,
childrenAPI
=
Named
.
ChildrenAPI
{
summaryChildrenEp
=
\
nt
o
l
->
runDBQuery
$
getChildren
targetNode
(
Proxy
::
Proxy
a
)
nt
o
l
}
,
tableAPI
=
tableApi
targetNode
,
tableNgramsAPI
=
apiNgramsTableCorpus
targetNode
,
catAPI
=
Named
.
CatAPI
$
catApi
targetNode
,
scoreAPI
=
Named
.
ScoreAPI
$
scoreApi
targetNode
,
catAPI
=
Named
.
CatAPI
{
categoriseEp
=
catApi
targetNode
}
,
scoreAPI
=
Named
.
ScoreAPI
{
scoreNodesEp
=
scoreApi
targetNode
}
,
searchAPI
=
Search
.
api
targetNode
,
shareAPI
=
Named
.
ShareNode
$
Share
.
api
userRootId
targetNode
,
shareAPI
=
Named
.
ShareNode
{
shareNodeEp
=
Share
.
api
userRootId
targetNode
}
,
unshareEp
=
Share
.
unShare
targetNode
,
publishAPI
=
withNamedPolicyT
authenticatedUser
(
publishChecks
targetNode
)
$
Named
.
PublishAPI
$
\
Named
.
PublishRequest
{
pubrq_policy
}
->
runDBTx
$
U
.
publish
loggedInUserId
targetNode
pubrq_policy
Named
.
PublishAPI
{
publishEp
=
\
Named
.
PublishRequest
{
pubrq_policy
}
->
runDBTx
$
U
.
publish
loggedInUserId
targetNode
pubrq_policy
}
---- Pairing utilities
,
pairWithEp
=
pairWith
targetNode
,
pairsEp
=
pairs
targetNode
,
pairingEp
=
Named
.
PairingAPI
$
getPair
targetNode
,
pairingEp
=
Named
.
PairingAPI
{
getPairingEp
=
getPair
targetNode
}
---- VIZ
,
scatterAPI
=
scatterApi
targetNode
,
chartAPI
=
chartApi
targetNode
,
pieAPI
=
pieApi
targetNode
,
treeAPI
=
treeApi
targetNode
,
phyloAPI
=
phyloAPI
targetNode
,
moveAPI
=
Named
.
MoveAPI
$
\
parentId
->
,
moveAPI
=
Named
.
MoveAPI
{
moveNodeEp
=
\
parentId
->
withPolicy
authenticatedUser
(
moveChecks
(
SourceId
targetNode
)
(
TargetId
parentId
))
$
moveNode
loggedInUserId
targetNode
parentId
moveNode
loggedInUserId
targetNode
parentId
}
,
fileAPI
=
Named
.
FileAPI
{
fileDownloadEp
=
fileApi
targetNode
}
,
fileAsyncAPI
=
fileAsyncApi
authenticatedUser
targetNode
,
dfwnAPI
=
DFWN
.
api
authenticatedUser
targetNode
...
...
src/Gargantext/API/Routes/Named/Corpus.hs
View file @
b3224bee
...
...
@@ -24,7 +24,7 @@ module Gargantext.API.Routes.Named.Corpus (
import
Data.Aeson.TH
(
deriveJSON
)
import
Data.Swagger
(
ToSchema
(
..
),
genericDeclareNamedSchema
)
import
Data.Text
(
Text
)
import
GHC.Generics
import
GHC.Generics
(
Generic
)
import
Gargantext.API.Node.Corpus.Export.Types
(
Corpus
,
CorpusSQLite
)
import
Gargantext.API.Node.Types
(
NewWithForm
,
WithQuery
)
import
Gargantext.API.Worker
(
WorkerAPI
)
...
...
src/Gargantext/API/Routes/Named/Count.hs
deleted
100644 → 0
View file @
44615be8
{-# LANGUAGE TypeOperators #-}
module
Gargantext.API.Routes.Named.Count
(
-- * Routes types
CountAPI
(
..
)
-- * Re-exports
,
module
X
)
where
import
GHC.Generics
(
Generic
)
import
Gargantext.API.Count.Types
as
X
import
Servant
newtype
CountAPI
mode
=
CountAPI
{
postCountsEp
::
mode
:-
Post
'[
J
SON
]
X
.
Counts
}
deriving
Generic
src/Gargantext/API/Routes/Named/Private.hs
View file @
b3224bee
...
...
@@ -30,19 +30,18 @@ import Gargantext.API.Auth.PolicyCheck (PolicyChecked)
import
Gargantext.API.Routes.Named.Contact
(
ContactAPI
)
import
Gargantext.API.Routes.Named.Context
(
ContextAPI
)
import
Gargantext.API.Routes.Named.Corpus
(
AddWithTempFile
,
AddWithQuery
,
CorpusExportAPI
,
MakeSubcorpusAPI
)
import
Gargantext.API.Routes.Named.Count
(
CountAPI
,
Query
)
import
Gargantext.API.Routes.Named.Document
(
DocumentExportAPI
)
import
Gargantext.API.Routes.Named.List
(
GETAPI
,
JSONAPI
,
TSVAPI
)
import
Gargantext.API.Routes.Named.Node
import
Gargantext.API.Routes.Named.Remote
import
Gargantext.API.Routes.Named.Share
import
Gargantext.API.Routes.Named.Table
import
Gargantext.API.Routes.Named.Tree
import
Gargantext.API.Routes.Named.Viz
import
Gargantext.Database.Admin.Types.Hyperdata.Any
import
Gargantext.Database.Admin.Types.Hyperdata.Corpus
import
Gargantext.Database.Admin.Types.Node
import
GHC.Generics
import
Gargantext.API.Routes.Named.Node
(
NodeAPI
,
NodesAPI
,
NodeNodeAPI
,
Roots
)
import
Gargantext.API.Routes.Named.Remote
(
RemoteImportAPI
)
import
Gargantext.API.Routes.Named.Share
(
ShareURL
)
import
Gargantext.API.Routes.Named.Table
(
TableNgramsAPI
)
import
Gargantext.API.Routes.Named.Tree
(
NodeTreeAPI
,
TreeFlatAPI
)
import
Gargantext.API.Routes.Named.Viz
(
GraphAPI
,
PhyloExportAPI
)
import
Gargantext.Database.Admin.Types.Hyperdata.Any
(
HyperdataAny
)
import
Gargantext.Database.Admin.Types.Hyperdata.Corpus
(
HyperdataAnnuaire
,
HyperdataCorpus
)
import
Gargantext.Database.Admin.Types.Node
(
ContextId
,
CorpusId
,
DocId
,
NodeId
)
import
GHC.Generics
(
Generic
)
import
Servant.API
import
Servant.Auth
qualified
as
SA
...
...
@@ -81,9 +80,6 @@ data GargPrivateAPI' mode = GargPrivateAPI'
:>
NamedRoutes
DocumentExportAPI
,
phyloExportAPI
::
mode
:-
"phylo"
:>
Capture
"node_id"
DocId
:>
NamedRoutes
PhyloExportAPI
,
countAPI
::
mode
:-
"count"
:>
Summary
"Count endpoint"
:>
ReqBody
'[
J
SON
]
Query
:>
NamedRoutes
CountAPI
,
graphAPI
::
mode
:-
"graph"
:>
Summary
"Graph endpoint"
:>
Capture
"graph_id"
NodeId
:>
NamedRoutes
GraphAPI
...
...
src/Gargantext/API/Routes/Named/Remote.hs
View file @
b3224bee
{-|
Module : Gargantext.API.Routes.Named.Remote
Description : Server API
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE TypeOperators #-}
module
Gargantext.API.Routes.Named.Remote
(
-- * Routes types
RemoteExportAPI
(
..
)
...
...
@@ -13,16 +25,15 @@ import Conduit qualified as C
import
Data.Aeson
as
JSON
import
Data.ByteString.Lazy
qualified
as
BL
import
Data.ByteString
qualified
as
BS
import
Data.Proxy
import
Data.Swagger
hiding
(
Http
)
import
Data.Proxy
(
Proxy
(
Proxy
))
import
Data.Swagger
(
NamedSchema
(
..
),
ToSchema
,
declareNamedSchema
,
binarySchema
,
sketchStrictSchema
)
import
Gargantext.API.Admin.Auth.Types
(
Token
)
import
Gargantext.API.Auth.PolicyCheck
(
PolicyChecked
)
import
Gargantext.Database.Admin.Types.Node
(
NodeId
(
..
)
)
import
GHC.Generics
import
GHC.Generics
(
Generic
)
import
Prelude
import
Servant.API
import
Servant.Client.Core.BaseUrl
import
Test.QuickCheck
import
Servant.Client.Core.BaseUrl
(
BaseUrl
(
..
),
parseBaseUrl
,
Scheme
(
Http
))
data
RemoteExportAPI
mode
=
RemoteExportAPI
...
...
@@ -42,9 +53,6 @@ data RemoteExportRequest =
,
_rer_instance_auth
::
Token
}
deriving
(
Show
,
Eq
,
Generic
)
instance
Arbitrary
RemoteExportRequest
where
arbitrary
=
RemoteExportRequest
<$>
(
pure
(
BaseUrl
Http
"dev.sub.gargantext.org"
8008
""
))
<*>
arbitrary
instance
ToJSON
RemoteExportRequest
where
toJSON
RemoteExportRequest
{
..
}
=
JSON
.
object
[
"instance_url"
.=
toJSON
_rer_instance_url
...
...
src/Gargantext/API/Routes/Named/Share.hs
View file @
b3224bee
...
...
@@ -17,7 +17,7 @@ import Data.Aeson (withText)
import
Data.Swagger
(
ToSchema
,
declareNamedSchema
)
import
Data.Text
qualified
as
T
import
Gargantext.API.Node.Share.Types
(
ShareNodeParams
(
..
)
)
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Admin.Types.Node
(
NodeId
,
NodeType
)
import
Gargantext.Prelude
import
Network.URI
(
parseURI
)
import
Prelude
(
fail
)
...
...
src/Gargantext/API/Search.hs
View file @
b3224bee
{-|
Module : Gargantext.API.
Count
Module : Gargantext.API.
Search
Description : Server API
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
...
...
src/Gargantext/API/Server/Named/Private.hs
View file @
b3224bee
...
...
@@ -5,7 +5,6 @@ module Gargantext.API.Server.Named.Private where
import
Gargantext.API.Admin.Auth.Types
(
AuthenticatedUser
(
..
))
import
Gargantext.API.Admin.EnvTypes
(
Env
)
import
Gargantext.API.Context
(
contextAPI
)
import
Gargantext.API.Count
qualified
as
Count
import
Gargantext.API.Errors.Types
(
BackendInternalError
)
import
Gargantext.API.Members
(
members
)
import
Gargantext.API.Ngrams.List
qualified
as
List
...
...
@@ -54,7 +53,6 @@ serverPrivateGargAPI' authenticatedUser@(AuthenticatedUser userNodeId userId)
,
tableNgramsAPI
=
apiNgramsTableDoc
authenticatedUser
,
phyloExportAPI
=
PhyloExport
.
api
userNodeId
,
documentExportAPI
=
documentExportAPI
userNodeId
,
countAPI
=
Count
.
countAPI
,
graphAPI
=
Viz
.
graphAPI
authenticatedUser
userId
,
treeAPI
=
Tree
.
treeAPI
authenticatedUser
,
treeFlatAPI
=
Tree
.
treeFlatAPI
authenticatedUser
...
...
stack.yaml
View file @
b3224bee
...
...
@@ -134,7 +134,7 @@
git
:
"
https://github.com/delanoe/patches-map"
subdirs
:
-
.
-
commit
:
7694f62af6bc1596d754b42af16da131ac403b3a
-
commit
:
c3c558d9278ef239a474f1e1b69afc461be60d01
git
:
"
https://github.com/fpringle/servant-routes.git"
subdirs
:
-
.
...
...
test/Test/Instances.hs
View file @
b3224bee
...
...
@@ -42,6 +42,7 @@ import Gargantext.API.Node.Update.Types qualified as NU
import
Gargantext.API.Node.Types
(
NewWithForm
,
NewWithTempFile
(
..
),
RenameNode
(
..
),
WithQuery
)
import
Gargantext.API.Public.Types
(
PublicData
(
..
))
import
Gargantext.API.Routes.Named.Publish
(
PublishRequest
(
..
))
import
Gargantext.API.Routes.Named.Remote
(
RemoteExportRequest
(
..
))
import
Gargantext.API.Search.Types
(
SearchQuery
(
..
),
SearchResult
(
..
),
SearchResultTypes
(
..
),
SearchType
(
..
))
import
Gargantext.API.Table.Types
(
TableQuery
(
..
))
import
Gargantext.API.Viz.Types
(
PhyloData
)
...
...
@@ -58,6 +59,7 @@ import Gargantext.Database.Admin.Types.Hyperdata qualified as Hyperdata
import
Gargantext.Database.Admin.Types.Node
(
NodeId
(
..
),
UserId
(
..
),
NodeType
(
..
))
import
Gargantext.Database.Query.Facet
(
OrderBy
(
..
))
import
Gargantext.Prelude
hiding
(
replace
,
Location
)
import
Servant.Client.Core.BaseUrl
(
BaseUrl
(
..
),
Scheme
(
Http
))
import
Text.Parsec.Error
(
ParseError
,
Message
(
..
),
newErrorMessage
)
import
Text.Parsec.Pos
import
Test.QuickCheck
...
...
@@ -155,6 +157,11 @@ defaultPublicData =
instance
Arbitrary
PublishRequest
where
arbitrary
=
PublishRequest
<$>
arbitraryBoundedEnum
instance
Arbitrary
RemoteExportRequest
where
arbitrary
=
RemoteExportRequest
<$>
(
pure
(
BaseUrl
Http
"dev.sub.gargantext.org"
8008
""
))
<*>
arbitrary
instance
Arbitrary
SearchQuery
where
arbitrary
=
elements
[
SearchQuery
(
RawQuery
"electrodes"
)
SearchDoc
]
-- arbitrary = elements [SearchQuery "electrodes" 1 ] --SearchDoc]
...
...
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