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
198
Issues
198
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
e923bba5
Commit
e923bba5
authored
Jul 30, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] table api.
parent
d851559b
Pipeline
#533
failed with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
16 deletions
+14
-16
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+1
-1
Table.hs
src/Gargantext/API/Table.hs
+13
-15
No files found.
src/Gargantext/API/Ngrams.hs
View file @
e923bba5
...
...
@@ -102,7 +102,7 @@ instance ToParamSchema TODO where
data
TabType
=
Docs
|
Trash
|
MoreFav
|
MoreTrash
|
Terms
|
Sources
|
Authors
|
Institutes
|
Contacts
deriving
(
Generic
,
Enum
,
Bounded
)
deriving
(
Generic
,
Enum
,
Bounded
,
Show
)
instance
FromHttpApiData
TabType
where
...
...
src/Gargantext/API/Table.hs
View file @
e923bba5
...
...
@@ -63,11 +63,11 @@ type TableApi = Summary " Table API"
--{-
data
TableQuery
=
TableQuery
{
tq_offset
::
Maybe
Int
,
tq_limit
::
Maybe
Int
,
tq_orderBy
::
Maybe
OrderBy
,
tq_
tabType
::
Maybe
TabType
,
tq_
mQuery
::
Maybe
Text
{
tq_offset
::
Int
,
tq_limit
::
Int
,
tq_orderBy
::
OrderBy
,
tq_
view
::
TabType
,
tq_
query
::
Text
}
deriving
(
Generic
)
$
(
deriveJSON
(
unPrefix
"tq_"
)
''
T
ableQuery
)
...
...
@@ -78,17 +78,15 @@ instance ToSchema TableQuery where
defaultSchemaOptions
{
fieldLabelModifier
=
drop
3
}
instance
Arbitrary
TableQuery
where
arbitrary
=
elements
[
TableQuery
(
Just
0
)
(
Just
10
)
Nothing
(
Just
Docs
)
(
Just
"electrodes"
)
]
arbitrary
=
elements
[
TableQuery
0
10
DateAsc
Docs
"electrodes"
]
tableApi
::
NodeId
->
TableQuery
->
Cmd
err
[
FacetDoc
]
tableApi
cId
(
TableQuery
o
l
order
ft
Nothing
)
=
getTable
cId
ft
o
l
order
tableApi
cId
(
TableQuery
o
l
order
ft
(
Just
q
))
=
case
ft
of
Just
Docs
->
if
q
==
""
then
getTable
cId
ft
o
l
order
else
searchInCorpus
cId
[
q
]
o
l
order
Just
Trash
->
panic
"TODO search in Trash"
-- TODO searchInCorpus cId q o l order
_
->
panic
"not implemented: search in Fav/Trash/*"
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
Docs
->
searchInCorpus
cId
[
q
]
(
Just
o
)
(
Just
l
)
(
Just
order
)
Trash
->
panic
"TODO search in Trash"
-- TODO searchInCorpus cId q o l order
x
->
panic
$
"not implemented in tableApi "
<>
(
cs
$
show
x
)
getTable
::
NodeId
->
Maybe
TabType
->
Maybe
Offset
->
Maybe
Limit
...
...
@@ -99,7 +97,7 @@ getTable cId ft o l order =
(
Just
Trash
)
->
runViewDocuments
cId
True
o
l
order
(
Just
MoreFav
)
->
moreLike
cId
o
l
order
IsFav
(
Just
MoreTrash
)
->
moreLike
cId
o
l
order
IsTrash
_
->
panic
"not implemented"
x
->
panic
$
"not implemented in getTable: "
<>
(
cs
$
show
x
)
getPairing
::
ContactId
->
Maybe
TabType
->
Maybe
Offset
->
Maybe
Limit
...
...
@@ -108,6 +106,6 @@ getPairing cId ft o l order =
case
ft
of
(
Just
Docs
)
->
runViewAuthorsDoc
cId
False
o
l
order
(
Just
Trash
)
->
runViewAuthorsDoc
cId
True
o
l
order
_
->
panic
"not implemented"
_
->
panic
$
"not implemented: get Pairing"
<>
(
cs
$
show
ft
)
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