Commit b69c48c1 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[API] Add corpus username/uid.

parent dcaef593
......@@ -303,7 +303,7 @@ type GargPrivateAPI' =
:<|> New.AddWithForm
:<|> New.AddWithQuery
:<|> Annuaire.AddWithForm
:<|> "annuaire" :> Annuaire.AddWithForm
-- :<|> New.AddWithFile
-- :<|> "scraper" :> WithCallbacks ScraperAPI
-- :<|> "new" :> New.Api
......@@ -406,7 +406,7 @@ serverPrivateGargAPI' (AuthenticatedUser (NodeId uid))
-- TODO access
-- :<|> addUpload
-- :<|> (\corpus -> addWithQuery corpus :<|> addWithFile corpus)
:<|> addCorpusWithForm
:<|> addCorpusWithForm "user1"
:<|> addCorpusWithQuery
:<|> addAnnuaireWithForm
......@@ -432,15 +432,15 @@ addWithFile cid i f =
serveJobsAPI $
JobFunction (\_i log -> New.addToCorpusWithFile cid i f (liftIO . log))
addCorpusWithForm :: GargServer New.AddWithForm
addCorpusWithForm cid =
addCorpusWithForm :: Text -> GargServer New.AddWithForm
addCorpusWithForm username cid =
serveJobsAPI $
JobFunction (\i log ->
let
log' x = do
printDebug "addCorpusWithForm" x
liftIO $ log x
in New.addToCorpusWithForm cid i log')
in New.addToCorpusWithForm username cid i log')
addAnnuaireWithForm :: GargServer Annuaire.AddWithForm
addAnnuaireWithForm cid =
......
......@@ -214,6 +214,7 @@ addToCorpusWithFile cid input filetype logStatus = do
, _scst_remaining = Just 138
, _scst_events = Just []
}
printDebug "addToCorpusWithFile" cid
_h <- postUpload cid filetype input
pure ScraperStatus { _scst_succeeded = Just 137
......@@ -240,11 +241,12 @@ addToCorpusWithForm' cid (WithForm ft d l) logStatus = do
pure s'
-}
addToCorpusWithForm :: FlowCmdM env err m
=> CorpusId
=> Text
-> CorpusId
-> WithForm
-> (ScraperStatus -> m ())
-> m ScraperStatus
addToCorpusWithForm cid (WithForm ft d l _n) logStatus = do
addToCorpusWithForm username cid (WithForm ft d l _n) logStatus = do
let
parse = case ft of
......@@ -270,7 +272,7 @@ addToCorpusWithForm cid (WithForm ft d l _n) logStatus = do
printDebug "Starting extraction : " cid
-- TODO granularity of the logStatus
_cid' <- flowCorpus "user1"
_cid' <- flowCorpus username
(Right [cid])
(Multi $ fromMaybe EN l)
(map (map toHyperdataDocument) docs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment