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

[API] Add corpus username/uid.

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