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
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
Julien Moutinho
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
Changes
5
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:
...
@@ -38,6 +38,7 @@ library:
exposed-modules
:
exposed-modules
:
-
Gargantext
-
Gargantext
-
Gargantext.API
-
Gargantext.API
-
Gargantext.API.HashedResponse
-
Gargantext.API.Node
-
Gargantext.API.Node
-
Gargantext.API.Admin.Settings
-
Gargantext.API.Admin.Settings
-
Gargantext.API.Prelude
-
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
...
@@ -19,15 +19,12 @@ module Gargantext.API.Metrics
where
where
import
Control.Lens
import
Control.Lens
import
Data.Aeson
import
qualified
Data.Digest.Pure.MD5
as
DPMD5
import
Data.Swagger
import
Data.Time
(
UTCTime
)
import
Data.Time
(
UTCTime
)
import
GHC.Generics
(
Generic
)
import
Protolude
import
Protolude
import
Servant
import
Servant
import
qualified
Data.Map
as
Map
import
qualified
Data.Map
as
Map
import
Gargantext.API.HashedResponse
import
Gargantext.API.Ngrams
import
Gargantext.API.Ngrams
import
Gargantext.API.Ngrams.NTree
import
Gargantext.API.Ngrams.NTree
import
Gargantext.API.Prelude
(
GargServer
)
import
Gargantext.API.Prelude
(
GargServer
)
...
@@ -46,18 +43,6 @@ import Gargantext.Text.Metrics (Scored(..))
...
@@ -46,18 +43,6 @@ import Gargantext.Text.Metrics (Scored(..))
import
Gargantext.Viz.Chart
import
Gargantext.Viz.Chart
import
Gargantext.Viz.Types
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
-- | Scatter metrics API
type
ScatterAPI
=
Summary
"SepGen IncExc metrics"
type
ScatterAPI
=
Summary
"SepGen IncExc metrics"
...
...
src/Gargantext/API/Ngrams.hs
View file @
4caaf612
...
@@ -148,7 +148,7 @@ data TabType = Docs | Trash | MoreFav | MoreTrash
...
@@ -148,7 +148,7 @@ data TabType = Docs | Trash | MoreFav | MoreTrash
deriving
(
Generic
,
Enum
,
Bounded
,
Show
)
deriving
(
Generic
,
Enum
,
Bounded
,
Show
)
instance
FromHttpApiData
TabType
instance
FromHttpApiData
TabType
where
where
parseUrlPiece
"Docs"
=
pure
Docs
parseUrlPiece
"Docs"
=
pure
Docs
parseUrlPiece
"Trash"
=
pure
Trash
parseUrlPiece
"Trash"
=
pure
Trash
parseUrlPiece
"MoreFav"
=
pure
MoreFav
parseUrlPiece
"MoreFav"
=
pure
MoreFav
...
...
src/Gargantext/API/Table.hs
View file @
4caaf612
...
@@ -40,6 +40,7 @@ import Servant
...
@@ -40,6 +40,7 @@ import Servant
import
Test.QuickCheck
(
elements
)
import
Test.QuickCheck
(
elements
)
import
Test.QuickCheck.Arbitrary
(
Arbitrary
,
arbitrary
)
import
Test.QuickCheck.Arbitrary
(
Arbitrary
,
arbitrary
)
import
Gargantext.API.HashedResponse
import
Gargantext.API.Ngrams
(
TabType
(
..
))
import
Gargantext.API.Ngrams
(
TabType
(
..
))
import
Gargantext.API.Prelude
(
GargServer
)
import
Gargantext.API.Prelude
(
GargServer
)
import
Gargantext.Core.Types
(
Offset
,
Limit
,
TableResult
(
..
))
import
Gargantext.Core.Types
(
Offset
,
Limit
,
TableResult
(
..
))
...
@@ -55,10 +56,14 @@ import Gargantext.Prelude
...
@@ -55,10 +56,14 @@ import Gargantext.Prelude
type
TableApi
=
Summary
"Table API"
type
TableApi
=
Summary
"Table API"
:>
QueryParam
"tabType"
TabType
:>
QueryParam
"tabType"
TabType
:>
Get
'[
J
SON
]
FacetTableResult
:>
Get
'[
J
SON
]
(
HashedResponse
FacetTableResult
)
:<|>
Summary
"Table API (POST)"
:<|>
Summary
"Table API (POST)"
:>
ReqBody
'[
J
SON
]
TableQuery
:>
ReqBody
'[
J
SON
]
TableQuery
:>
Post
'[
J
SON
]
FacetTableResult
:>
Post
'[
J
SON
]
FacetTableResult
:<|>
"md5"
:>
Summary
"Table md5"
:>
QueryParam
"tabType"
TabType
:>
Get
'[
J
SON
]
Text
data
TableQuery
=
TableQuery
data
TableQuery
=
TableQuery
{
tq_offset
::
Int
{
tq_offset
::
Int
...
@@ -82,10 +87,13 @@ instance Arbitrary TableQuery where
...
@@ -82,10 +87,13 @@ instance Arbitrary TableQuery where
tableApi
::
NodeId
->
GargServer
TableApi
tableApi
::
NodeId
->
GargServer
TableApi
tableApi
id'
=
getTableApi
id'
tableApi
id'
=
getTableApi
id'
:<|>
postTableApi
id'
:<|>
postTableApi
id'
:<|>
getTableMd5Api
id'
getTableApi
::
NodeId
->
Maybe
TabType
->
Cmd
err
FacetTableResult
getTableApi
::
NodeId
->
Maybe
TabType
->
Cmd
err
(
HashedResponse
FacetTableResult
)
getTableApi
cId
tabType
=
getTable
cId
tabType
Nothing
Nothing
Nothing
getTableApi
cId
tabType
=
do
t
<-
getTable
cId
tabType
Nothing
Nothing
Nothing
pure
$
constructHashedResponse
t
postTableApi
::
NodeId
->
TableQuery
->
Cmd
err
FacetTableResult
postTableApi
::
NodeId
->
TableQuery
->
Cmd
err
FacetTableResult
...
@@ -95,6 +103,11 @@ postTableApi cId (TableQuery o l order ft q) = case ft of
...
@@ -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
)
Trash
->
searchInCorpus'
cId
True
[
q
]
(
Just
o
)
(
Just
l
)
(
Just
order
)
x
->
panic
$
"not implemented in tableApi "
<>
(
cs
$
show
x
)
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
searchInCorpus'
::
CorpusId
->
Bool
->
Bool
->
[
Text
]
->
[
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