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
f81fa897
Commit
f81fa897
authored
Jul 30, 2021
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
[FIX] merge
parents
b13dfc93
f8ba5ba1
Pipeline
#1691
passed with stage
in 35 minutes and 2 seconds
Changes
4
Pipelines
1
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
name
:
gargantext
version
:
'
0.0.2.9.6'
version
:
'
0.0.2.9.6
.1
'
synopsis
:
Search, map, share
synopsis
:
Search, map, share
description
:
Please see README.md
description
:
Please see README.md
category
:
Data
category
:
Data
...
...
src/Gargantext/API/Ngrams.hs
View file @
f81fa897
...
@@ -262,6 +262,7 @@ setListNgrams listId ngramsType ns = do
...
@@ -262,6 +262,7 @@ setListNgrams listId ngramsType ns = do
.
something
.
something
)
)
)
)
printDebug
"List modified"
NodeList
saveRepo
saveRepo
...
...
src/Gargantext/API/Ngrams/List.hs
View file @
f81fa897
...
@@ -59,6 +59,62 @@ import Gargantext.Database.Schema.Node
...
@@ -59,6 +59,62 @@ import Gargantext.Database.Schema.Node
import
Gargantext.Database.Types
(
Indexed
(
..
))
import
Gargantext.Database.Types
(
Indexed
(
..
))
import
Gargantext.Prelude
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
=>
get
::
RepoCmdM
env
err
m
=>
...
@@ -87,6 +143,7 @@ post :: FlowCmdM env err m
...
@@ -87,6 +143,7 @@ post :: FlowCmdM env err m
->
m
Bool
->
m
Bool
post
l
m
=
do
post
l
m
=
do
-- TODO check with Version for optim
-- TODO check with Version for optim
printDebug
"New list as file"
l
_
<-
mapM
(
\
(
nt
,
Versioned
_v
ns
)
->
setListNgrams
l
nt
ns
)
$
toList
m
_
<-
mapM
(
\
(
nt
,
Versioned
_v
ns
)
->
setListNgrams
l
nt
ns
)
$
toList
m
-- TODO reindex
-- TODO reindex
pure
True
pure
True
...
@@ -163,10 +220,15 @@ type PostAPI = Summary "Update List"
...
@@ -163,10 +220,15 @@ type PostAPI = Summary "Update List"
:>
"async"
:>
"async"
:>
AsyncJobs
JobLog
'[
F
ormUrlEncoded
]
WithFile
JobLog
:>
AsyncJobs
JobLog
'[
F
ormUrlEncoded
]
WithFile
JobLog
postAsync
::
ListId
->
GargServer
Post
API
postAsync
::
GargServer
JSON
API
postAsync
lId
=
postAsync
lId
=
serveJobsAPI
$
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
postAsync'
::
FlowCmdM
env
err
m
=>
ListId
=>
ListId
...
@@ -180,7 +242,9 @@ postAsync' l (WithFile _ m _) logStatus = do
...
@@ -180,7 +242,9 @@ postAsync' l (WithFile _ m _) logStatus = do
,
_scst_remaining
=
Just
1
,
_scst_remaining
=
Just
1
,
_scst_events
=
Just
[]
,
_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
pure
JobLog
{
_scst_succeeded
=
Just
1
,
_scst_failed
=
Just
0
,
_scst_failed
=
Just
0
...
@@ -223,14 +287,10 @@ csvPost l m = do
...
@@ -223,14 +287,10 @@ csvPost l m = do
_
<-
setListNgrams
l
NgramsTerms
p
_
<-
setListNgrams
l
NgramsTerms
p
pure
True
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
=
csvPostAsync
lId
=
serveJobsAPI
$
serveJobsAPI
$
JobFunction
$
\
f
@
(
WithTextFile
ft
_
n
)
log'
->
do
JobFunction
$
\
f
@
(
WithTextFile
ft
_
n
)
log'
->
do
...
@@ -260,16 +320,3 @@ csvPostAsync' l (WithTextFile _ m _) logStatus = 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' =
...
@@ -160,9 +160,11 @@ type GargPrivateAPI' =
-- :<|> "scraper" :> WithCallbacks ScraperAPI
-- :<|> "scraper" :> WithCallbacks ScraperAPI
-- :<|> "new" :> New.Api
-- :<|> "new" :> New.Api
:<|>
"lists"
:>
Summary
"List export API"
-- TODO refactor the 3 routes below
:>
Capture
"listId"
ListId
:<|>
List
.
GETAPI
:>
List
.
API
:<|>
List
.
JSONAPI
:<|>
List
.
CSVAPI
{-
{-
:<|> "wait" :> Summary "Wait test"
:<|> "wait" :> Summary "Wait test"
:> Capture "x" Int
:> Capture "x" Int
...
@@ -237,7 +239,9 @@ serverPrivateGargAPI' (AuthenticatedUser (NodeId uid))
...
@@ -237,7 +239,9 @@ serverPrivateGargAPI' (AuthenticatedUser (NodeId uid))
-- :<|> addAnnuaireWithForm
-- :<|> addAnnuaireWithForm
-- :<|> New.api uid -- TODO-SECURITY
-- :<|> New.api uid -- TODO-SECURITY
-- :<|> New.info uid -- TODO-SECURITY
-- :<|> New.info uid -- TODO-SECURITY
:<|>
List
.
api
:<|>
List
.
getApi
:<|>
List
.
jsonApi
:<|>
List
.
csvApi
-- :<|> waitAPI
-- :<|> 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