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