Commit 7ad8c683 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[API][Async] withFile route ok

parent 1ba8f6b2
Pipeline #4656 failed with stage
in 9 minutes and 9 seconds
......@@ -284,7 +284,7 @@ type GargPrivateAPI' =
:> TreeAPI
:<|> New.AddWithQuery
-- :<|> New.AddWithFile
:<|> New.AddWithFile
-- :<|> "scraper" :> WithCallbacks ScraperAPI
-- :<|> "new" :> New.Api
......@@ -365,7 +365,7 @@ serverPrivateGargAPI' (AuthenticatedUser (NodeId uid))
<$> PathNode <*> treeAPI
-- TODO access
:<|> addWithQuery
-- :<|> addWithQuery
:<|> addWithFile
-- :<|> addToCorpus
-- :<|> New.api uid -- TODO-SECURITY
-- :<|> New.info uid -- TODO-SECURITY
......
......@@ -138,10 +138,10 @@ deriveJSON (unPrefix "_scst_") 'ScraperStatus
----------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
data WithQuery = WithQuery
{ _wq_query :: !Text
, _wq_corpus :: !Int
, _wq_databases :: ![ExternalAPIs]
}
deriving Generic
......@@ -151,17 +151,20 @@ makeLenses ''WithQuery
instance FromJSON WithQuery where
parseJSON = genericParseJSON $ jsonOptions "_wq_"
instance ToSchema WithQuery -- TODO _scin2_ prefix
instance ToSchema WithQuery
type (AddAPI m) = AsyncJobsAPI ScraperStatus m ScraperStatus
------------------------------------------------------------------------
type
AddAPI withInput = AsyncJobsAPI ScraperStatus withInput ScraperStatus
------------------------------------------------------------------------
type AddWithQuery = Summary "Add to corpus endpoint"
:> "corpus"
:> Capture "corpus_id" CorpusId
:> "add" :> "query" :> "async" :> (AddAPI WithQuery)
type WithUpload' = QueryParam "fileType" FileType
:> "add"
:> "query"
:> "async"
:> AddAPI WithQuery
type AddWithFile = Summary "Add to corpus endpoint"
:> "corpus"
......@@ -170,9 +173,10 @@ type AddWithFile = Summary "Add to corpus endpoint"
:> "file"
:> MultipartForm Mem (MultipartData Mem)
:> QueryParam "fileType" FileType
:> "async" :> (AddAPI WithQuery)
:> "async"
:> AddAPI ()
------------------------------------------------------------------------
-- TODO WithQuery also has a corpus id
addToCorpusJobFunction :: FlowCmdM env err m
=> CorpusId
......
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