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
195
Issues
195
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
4caaf612
Commit
4caaf612
authored
Jul 01, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[docs table] hashed response in docs table
parent
c9674b6e
Pipeline
#918
failed with stage
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
20 deletions
+38
-20
package.yaml
package.yaml
+1
-0
HashedResponse.hs
src/Gargantext/API/HashedResponse.hs
+19
-0
Metrics.hs
src/Gargantext/API/Metrics.hs
+1
-16
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+1
-1
Table.hs
src/Gargantext/API/Table.hs
+16
-3
No files found.
package.yaml
View file @
4caaf612
...
...
@@ -38,6 +38,7 @@ library:
exposed-modules
:
-
Gargantext
-
Gargantext.API
-
Gargantext.API.HashedResponse
-
Gargantext.API.Node
-
Gargantext.API.Admin.Settings
-
Gargantext.API.Prelude
...
...
src/Gargantext/API/HashedResponse.hs
0 → 100644
View file @
4caaf612
module
Gargantext.API.HashedResponse
where
import
Data.Aeson
import
Data.Swagger
import
qualified
Data.Digest.Pure.MD5
as
DPMD5
import
GHC.Generics
(
Generic
)
import
Protolude
data
HashedResponse
a
=
HashedResponse
{
md5
::
Text
,
value
::
a
}
deriving
(
Generic
)
instance
ToSchema
a
=>
ToSchema
(
HashedResponse
a
)
instance
ToJSON
a
=>
ToJSON
(
HashedResponse
a
)
where
toJSON
=
genericToJSON
defaultOptions
constructHashedResponse
::
ToJSON
a
=>
a
->
HashedResponse
a
constructHashedResponse
v
=
HashedResponse
{
md5
=
md5'
,
value
=
v
}
where
md5'
=
show
$
DPMD5
.
md5
$
encode
v
\ No newline at end of file
src/Gargantext/API/Metrics.hs
View file @
4caaf612
...
...
@@ -19,15 +19,12 @@ module Gargantext.API.Metrics
where
import
Control.Lens
import
Data.Aeson
import
qualified
Data.Digest.Pure.MD5
as
DPMD5
import
Data.Swagger
import
Data.Time
(
UTCTime
)
import
GHC.Generics
(
Generic
)
import
Protolude
import
Servant
import
qualified
Data.Map
as
Map
import
Gargantext.API.HashedResponse
import
Gargantext.API.Ngrams
import
Gargantext.API.Ngrams.NTree
import
Gargantext.API.Prelude
(
GargServer
)
...
...
@@ -46,18 +43,6 @@ import Gargantext.Text.Metrics (Scored(..))
import
Gargantext.Viz.Chart
import
Gargantext.Viz.Types
data
HashedResponse
a
=
HashedResponse
{
md5
::
Text
,
value
::
a
}
deriving
(
Generic
)
instance
ToSchema
a
=>
ToSchema
(
HashedResponse
a
)
instance
ToJSON
a
=>
ToJSON
(
HashedResponse
a
)
where
toJSON
=
genericToJSON
defaultOptions
constructHashedResponse
::
ToJSON
a
=>
a
->
HashedResponse
a
constructHashedResponse
chart
=
HashedResponse
{
md5
=
md5'
,
value
=
chart
}
where
md5'
=
show
$
DPMD5
.
md5
$
encode
chart
-------------------------------------------------------------
-- | Scatter metrics API
type
ScatterAPI
=
Summary
"SepGen IncExc metrics"
...
...
src/Gargantext/API/Ngrams.hs
View file @
4caaf612
...
...
@@ -148,7 +148,7 @@ data TabType = Docs | Trash | MoreFav | MoreTrash
deriving
(
Generic
,
Enum
,
Bounded
,
Show
)
instance
FromHttpApiData
TabType
where
where
parseUrlPiece
"Docs"
=
pure
Docs
parseUrlPiece
"Trash"
=
pure
Trash
parseUrlPiece
"MoreFav"
=
pure
MoreFav
...
...
src/Gargantext/API/Table.hs
View file @
4caaf612
...
...
@@ -40,6 +40,7 @@ import Servant
import
Test.QuickCheck
(
elements
)
import
Test.QuickCheck.Arbitrary
(
Arbitrary
,
arbitrary
)
import
Gargantext.API.HashedResponse
import
Gargantext.API.Ngrams
(
TabType
(
..
))
import
Gargantext.API.Prelude
(
GargServer
)
import
Gargantext.Core.Types
(
Offset
,
Limit
,
TableResult
(
..
))
...
...
@@ -55,10 +56,14 @@ import Gargantext.Prelude
type
TableApi
=
Summary
"Table API"
:>
QueryParam
"tabType"
TabType
:>
Get
'[
J
SON
]
FacetTableResult
:>
Get
'[
J
SON
]
(
HashedResponse
FacetTableResult
)
:<|>
Summary
"Table API (POST)"
:>
ReqBody
'[
J
SON
]
TableQuery
:>
Post
'[
J
SON
]
FacetTableResult
:<|>
"md5"
:>
Summary
"Table md5"
:>
QueryParam
"tabType"
TabType
:>
Get
'[
J
SON
]
Text
data
TableQuery
=
TableQuery
{
tq_offset
::
Int
...
...
@@ -82,10 +87,13 @@ instance Arbitrary TableQuery where
tableApi
::
NodeId
->
GargServer
TableApi
tableApi
id'
=
getTableApi
id'
:<|>
postTableApi
id'
:<|>
getTableMd5Api
id'
getTableApi
::
NodeId
->
Maybe
TabType
->
Cmd
err
FacetTableResult
getTableApi
cId
tabType
=
getTable
cId
tabType
Nothing
Nothing
Nothing
getTableApi
::
NodeId
->
Maybe
TabType
->
Cmd
err
(
HashedResponse
FacetTableResult
)
getTableApi
cId
tabType
=
do
t
<-
getTable
cId
tabType
Nothing
Nothing
Nothing
pure
$
constructHashedResponse
t
postTableApi
::
NodeId
->
TableQuery
->
Cmd
err
FacetTableResult
...
...
@@ -95,6 +103,11 @@ postTableApi cId (TableQuery o l order ft q) = case ft of
Trash
->
searchInCorpus'
cId
True
[
q
]
(
Just
o
)
(
Just
l
)
(
Just
order
)
x
->
panic
$
"not implemented in tableApi "
<>
(
cs
$
show
x
)
getTableMd5Api
::
NodeId
->
Maybe
TabType
->
Cmd
err
Text
getTableMd5Api
cId
tabType
=
do
HashedResponse
{
md5
=
md5'
}
<-
getTableApi
cId
tabType
pure
md5'
searchInCorpus'
::
CorpusId
->
Bool
->
[
Text
]
...
...
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