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
cc87388f
Commit
cc87388f
authored
Jun 30, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[docs table] add GET request support
parent
4b6baab2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
Table.hs
src/Gargantext/API/Table.hs
+21
-7
No files found.
src/Gargantext/API/Table.hs
View file @
cc87388f
...
...
@@ -36,7 +36,12 @@ import Data.Maybe
import
Data.Swagger
import
Data.Text
(
Text
())
import
GHC.Generics
(
Generic
)
import
Servant
import
Test.QuickCheck
(
elements
)
import
Test.QuickCheck.Arbitrary
(
Arbitrary
,
arbitrary
)
import
Gargantext.API.Ngrams
(
TabType
(
..
))
import
Gargantext.API.Prelude
(
GargServer
)
import
Gargantext.Core.Types
(
Offset
,
Limit
,
TableResult
(
..
))
import
Gargantext.Core.Utils.Prefix
(
unPrefix
,
unPrefixSwagger
)
import
Gargantext.Database.Query.Facet
(
FacetDoc
,
runViewDocuments
,
OrderBy
(
..
),
runViewAuthorsDoc
)
...
...
@@ -45,13 +50,13 @@ import Gargantext.Database.Action.Search
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Prelude
-- (Cmd, CmdM)
import
Gargantext.Prelude
import
Servant
import
Test.QuickCheck
(
elements
)
import
Test.QuickCheck.Arbitrary
(
Arbitrary
,
arbitrary
)
------------------------------------------------------------------------
type
TableApi
=
Summary
" Table API"
type
TableApi
=
Summary
"Table API"
:>
QueryParam
"tabType"
TabType
:>
Get
'[
J
SON
]
FacetTableResult
:<|>
Summary
"Table API (POST)"
:>
ReqBody
'[
J
SON
]
TableQuery
:>
Post
'[
J
SON
]
FacetTableResult
...
...
@@ -74,9 +79,18 @@ instance Arbitrary TableQuery where
arbitrary
=
elements
[
TableQuery
0
10
DateAsc
Docs
"electrodes"
]
tableApi
::
NodeId
->
TableQuery
->
Cmd
err
FacetTableResult
tableApi
cId
(
TableQuery
o
l
order
ft
""
)
=
getTable
cId
(
Just
ft
)
(
Just
o
)
(
Just
l
)
(
Just
order
)
tableApi
cId
(
TableQuery
o
l
order
ft
q
)
=
case
ft
of
tableApi
::
NodeId
->
GargServer
TableApi
tableApi
id'
=
getTableApi
id'
:<|>
postTableApi
id'
getTableApi
::
NodeId
->
Maybe
TabType
->
Cmd
err
FacetTableResult
getTableApi
cId
tabType
=
getTable
cId
tabType
Nothing
Nothing
Nothing
postTableApi
::
NodeId
->
TableQuery
->
Cmd
err
FacetTableResult
postTableApi
cId
(
TableQuery
o
l
order
ft
""
)
=
getTable
cId
(
Just
ft
)
(
Just
o
)
(
Just
l
)
(
Just
order
)
postTableApi
cId
(
TableQuery
o
l
order
ft
q
)
=
case
ft
of
Docs
->
searchInCorpus'
cId
False
[
q
]
(
Just
o
)
(
Just
l
)
(
Just
order
)
Trash
->
searchInCorpus'
cId
True
[
q
]
(
Just
o
)
(
Just
l
)
(
Just
order
)
x
->
panic
$
"not implemented in tableApi "
<>
(
cs
$
show
x
)
...
...
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