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
f81fa897
Commit
f81fa897
authored
Jul 30, 2021
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
[FIX] merge
parents
b13dfc93
f8ba5ba1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
28 deletions
+80
-28
package.yaml
package.yaml
+1
-1
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+1
-0
List.hs
src/Gargantext/API/Ngrams/List.hs
+70
-23
Routes.hs
src/Gargantext/API/Routes.hs
+8
-4
No files found.
package.yaml
View file @
f81fa897
name
:
gargantext
version
:
'
0.0.2.9.6'
version
:
'
0.0.2.9.6
.1
'
synopsis
:
Search, map, share
description
:
Please see README.md
category
:
Data
...
...
src/Gargantext/API/Ngrams.hs
View file @
f81fa897
...
...
@@ -262,6 +262,7 @@ setListNgrams listId ngramsType ns = do
.
something
)
)
printDebug
"List modified"
NodeList
saveRepo
...
...
src/Gargantext/API/Ngrams/List.hs
View file @
f81fa897
...
...
@@ -59,6 +59,62 @@ import Gargantext.Database.Schema.Node
import
Gargantext.Database.Types
(
Indexed
(
..
))
import
Gargantext.Prelude
------------------------------------------------------------------------
{-
-- | TODO refactor
type API = Get '[JSON, HTML] (Headers '[Header "Content-Disposition" Text] NgramsList)
-- :<|> ReqBody '[JSON] NgramsList :> Post '[JSON] Bool
:<|> PostAPI
:<|> CSVPostAPI
api :: ListId -> GargServer API
api l = get l :<|> postAsync l :<|> csvPostAsync l
-}
----------------------
type
GETAPI
=
Summary
"Get List"
:>
"lists"
:>
Capture
"listId"
ListId
:>
Get
'[
J
SON
,
HTML
]
(
Headers
'[
H
eader
"Content-Disposition"
Text
]
NgramsList
)
getApi
::
GargServer
GETAPI
getApi
=
get
data
HTML
instance
Accept
HTML
where
contentType
_
=
"text"
//
"html"
/:
(
"charset"
,
"utf-8"
)
instance
ToJSON
a
=>
MimeRender
HTML
a
where
mimeRender
_
=
encode
----------------------
type
JSONAPI
=
Summary
"Update List"
:>
"lists"
:>
Capture
"listId"
ListId
:>
"add"
:>
"form"
:>
"async"
:>
AsyncJobs
JobLog
'[
F
ormUrlEncoded
]
WithFile
JobLog
jsonApi
::
GargServer
JSONAPI
jsonApi
=
postAsync
----------------------
type
CSVAPI
=
Summary
"Update List (legacy v3 CSV)"
:>
"lists"
:>
Capture
"listId"
ListId
:>
"csv"
:>
"add"
:>
"form"
:>
"async"
:>
AsyncJobs
JobLog
'[
F
ormUrlEncoded
]
WithTextFile
JobLog
csvApi
::
GargServer
CSVAPI
csvApi
=
csvPostAsync
----------------------
------------------------------------------------------------------------
get
::
RepoCmdM
env
err
m
=>
...
...
@@ -87,6 +143,7 @@ post :: FlowCmdM env err m
->
m
Bool
post
l
m
=
do
-- TODO check with Version for optim
printDebug
"New list as file"
l
_
<-
mapM
(
\
(
nt
,
Versioned
_v
ns
)
->
setListNgrams
l
nt
ns
)
$
toList
m
-- TODO reindex
pure
True
...
...
@@ -163,10 +220,15 @@ type PostAPI = Summary "Update List"
:>
"async"
:>
AsyncJobs
JobLog
'[
F
ormUrlEncoded
]
WithFile
JobLog
postAsync
::
ListId
->
GargServer
Post
API
postAsync
::
GargServer
JSON
API
postAsync
lId
=
serveJobsAPI
$
JobFunction
(
\
f
log'
->
postAsync'
lId
f
(
liftBase
.
log'
))
JobFunction
(
\
f
log'
->
let
log''
x
=
do
printDebug
"postAsync ListId"
x
liftBase
$
log'
x
in
postAsync'
lId
f
log''
)
postAsync'
::
FlowCmdM
env
err
m
=>
ListId
...
...
@@ -180,7 +242,9 @@ postAsync' l (WithFile _ m _) logStatus = do
,
_scst_remaining
=
Just
1
,
_scst_events
=
Just
[]
}
_r
<-
post
l
m
printDebug
"New list as file"
l
_
<-
post
l
m
-- printDebug "Done" r
pure
JobLog
{
_scst_succeeded
=
Just
1
,
_scst_failed
=
Just
0
...
...
@@ -223,14 +287,10 @@ csvPost l m = do
_
<-
setListNgrams
l
NgramsTerms
p
pure
True
------------------------------------------------------------------------
type
CSVPostAPI
=
Summary
"Update List (legacy v3 CSV)"
:>
"csv"
:>
"add"
:>
"form"
:>
"async"
:>
AsyncJobs
JobLog
'[
F
ormUrlEncoded
]
WithTextFile
JobLog
csvPostAsync
::
ListId
->
GargServer
CSVPostAPI
csvPostAsync
::
GargServer
CSVAPI
csvPostAsync
lId
=
serveJobsAPI
$
JobFunction
$
\
f
@
(
WithTextFile
ft
_
n
)
log'
->
do
...
...
@@ -260,16 +320,3 @@ csvPostAsync' l (WithTextFile _ m _) logStatus = do
}
------------------------------------------------------------------------
type
API
=
Get
'[
J
SON
,
HTML
]
(
Headers
'[
H
eader
"Content-Disposition"
Text
]
NgramsList
)
-- :<|> ReqBody '[JSON] NgramsList :> Post '[JSON] Bool
:<|>
PostAPI
:<|>
CSVPostAPI
api
::
ListId
->
GargServer
API
api
l
=
get
l
:<|>
postAsync
l
:<|>
csvPostAsync
l
data
HTML
instance
Accept
HTML
where
contentType
_
=
"text"
//
"html"
/:
(
"charset"
,
"utf-8"
)
instance
ToJSON
a
=>
MimeRender
HTML
a
where
mimeRender
_
=
encode
src/Gargantext/API/Routes.hs
View file @
f81fa897
...
...
@@ -160,9 +160,11 @@ type GargPrivateAPI' =
-- :<|> "scraper" :> WithCallbacks ScraperAPI
-- :<|> "new" :> New.Api
:<|>
"lists"
:>
Summary
"List export API"
:>
Capture
"listId"
ListId
:>
List
.
API
-- TODO refactor the 3 routes below
:<|>
List
.
GETAPI
:<|>
List
.
JSONAPI
:<|>
List
.
CSVAPI
{-
:<|> "wait" :> Summary "Wait test"
:> Capture "x" Int
...
...
@@ -237,7 +239,9 @@ serverPrivateGargAPI' (AuthenticatedUser (NodeId uid))
-- :<|> addAnnuaireWithForm
-- :<|> New.api uid -- TODO-SECURITY
-- :<|> New.info uid -- TODO-SECURITY
:<|>
List
.
api
:<|>
List
.
getApi
:<|>
List
.
jsonApi
:<|>
List
.
csvApi
-- :<|> waitAPI
...
...
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