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
5b626d4a
Verified
Commit
5b626d4a
authored
Sep 14, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[refactor] some more record syntax refactorign
parent
67bc405e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
16 deletions
+22
-16
Public.hs
src/Gargantext/API/Public.hs
+17
-15
Table.hs
src/Gargantext/API/Table.hs
+5
-1
No files found.
src/Gargantext/API/Public.hs
View file @
5b626d4a
...
...
@@ -21,7 +21,7 @@ import Data.Maybe (catMaybes)
import
Data.Text
(
Text
)
import
Data.List
(
replicate
,
null
)
import
Data.Aeson
import
Data.Swagger
import
Data.Swagger
hiding
(
title
,
url
)
import
GHC.Generics
(
Generic
)
import
Servant
import
Test.QuickCheck
(
elements
)
...
...
@@ -107,13 +107,15 @@ publicNodes = do
-- http://localhost:8008/api/v1.0/node/23543/file/download<Paste>
-- http://localhost:8000/images/Gargantextuel-212x300.jpg
toPublicData
::
Text
->
(
Node
HyperdataFolder
,
[
NodeId
])
->
Maybe
PublicData
toPublicData
base
(
n
,
mn
)
=
PublicData
<$>
(
hd
^?
(
_Just
.
hf_data
.
cf_title
))
<*>
(
hd
^?
(
_Just
.
hf_data
.
cf_desc
))
<*>
(
Just
$
url'
mn
)
-- "images/Gargantextuel-212x300.jpg"
<*>
(
Just
$
url'
mn
)
<*>
Just
(
cs
$
show
$
utc2year
(
n
^.
node_date
))
<*>
(
hd
^?
(
_Just
.
hf_data
.
cf_query
))
<*>
(
hd
^?
(
_Just
.
hf_data
.
cf_authors
))
toPublicData
base
(
n
,
mn
)
=
do
title
<-
(
hd
^?
(
_Just
.
hf_data
.
cf_title
))
abstract
<-
(
hd
^?
(
_Just
.
hf_data
.
cf_desc
))
img
<-
(
Just
$
url'
mn
)
-- "images/Gargantextuel-212x300.jpg"
url
<-
(
Just
$
url'
mn
)
date
<-
Just
(
cs
$
show
$
utc2year
(
n
^.
node_date
))
database
<-
(
hd
^?
(
_Just
.
hf_data
.
cf_query
))
author
<-
(
hd
^?
(
_Just
.
hf_data
.
cf_authors
))
pure
$
PublicData
{
..
}
where
hd
=
head
$
filter
(
\
(
HyperdataField
cd
_
_
)
->
cd
==
JSON
)
...
...
@@ -150,13 +152,13 @@ instance Arbitrary PublicData where
defaultPublicData
::
PublicData
defaultPublicData
=
PublicData
"Title"
(
foldl
(
<>
)
""
$
replicate
100
"abstract "
)
"images/Gargantextuel-212x300.jpg"
"https://.."
"YY/MM/DD"
"database"
"Author"
PublicData
{
title
=
"Title"
,
abstract
=
foldl
(
<>
)
""
$
replicate
100
"abstract "
,
img
=
"images/Gargantextuel-212x300.jpg"
,
url
=
"https://.."
,
date
=
"YY/MM/DD"
,
database
=
"database"
,
author
=
"Author"
}
...
...
src/Gargantext/API/Table.hs
View file @
5b626d4a
...
...
@@ -86,7 +86,11 @@ instance ToSchema TableQuery where
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
"tq_"
)
instance
Arbitrary
TableQuery
where
arbitrary
=
elements
[
TableQuery
0
10
DateAsc
Docs
"electrodes"
]
arbitrary
=
elements
[
TableQuery
{
tq_offset
=
0
,
tq_limit
=
10
,
tq_orderBy
=
DateAsc
,
tq_view
=
Docs
,
tq_query
=
"electrodes"
}]
tableApi
::
NodeId
->
GargServer
TableApi
...
...
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