Commit 78e599d1 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[WIP] API upload, need ToSchema and Arbitrary instances.

parent 23e8378f
...@@ -75,6 +75,7 @@ import Gargantext.API.Ngrams (HasRepo(..), HasRepoSaver(..), saveRepo, ApiNgrams ...@@ -75,6 +75,7 @@ import Gargantext.API.Ngrams (HasRepo(..), HasRepoSaver(..), saveRepo, ApiNgrams
import Gargantext.API.Node import Gargantext.API.Node
import Gargantext.API.Search ( SearchAPI, search, SearchQuery) import Gargantext.API.Search ( SearchAPI, search, SearchQuery)
import Gargantext.API.Types import Gargantext.API.Types
import Gargantext.API.Upload
import Gargantext.Core.Types (HasInvalidError(..)) import Gargantext.Core.Types (HasInvalidError(..))
import Gargantext.Database.Facet import Gargantext.Database.Facet
import Gargantext.Database.Schema.Node (HasNodeError(..), NodeError) import Gargantext.Database.Schema.Node (HasNodeError(..), NodeError)
...@@ -278,6 +279,8 @@ type GargAPI' = ...@@ -278,6 +279,8 @@ type GargAPI' =
:<|> "tree" :> Summary "Tree endpoint" :<|> "tree" :> Summary "Tree endpoint"
:> Capture "id" NodeId :> TreeAPI :> Capture "id" NodeId :> TreeAPI
:<|> "upload" :> ApiUpload
-- :<|> "scraper" :> WithCallbacks ScraperAPI -- :<|> "scraper" :> WithCallbacks ScraperAPI
...@@ -320,6 +323,7 @@ serverGargAPI -- orchestrator ...@@ -320,6 +323,7 @@ serverGargAPI -- orchestrator
:<|> search :<|> search
:<|> graphAPI -- TODO: mock :<|> graphAPI -- TODO: mock
:<|> treeAPI :<|> treeAPI
:<|> upload
-- :<|> orchestrator -- :<|> orchestrator
where where
fakeUserId = 1 -- TODO fakeUserId = 1 -- TODO
......
...@@ -186,7 +186,6 @@ nodeAPI p uId id ...@@ -186,7 +186,6 @@ nodeAPI p uId id
:<|> phyloAPI id :<|> phyloAPI id
-- Annuaire -- Annuaire
-- :<|> upload
-- :<|> query -- :<|> query
------------------------------------------------------------------------ ------------------------------------------------------------------------
...@@ -361,25 +360,7 @@ query :: Monad m => Text -> m Text ...@@ -361,25 +360,7 @@ query :: Monad m => Text -> m Text
query s = pure s query s = pure s
-- | Upload files -------------------------------------------------------------
-- TODO Is it possible to adapt the function according to iValue input ?
--upload :: MultipartData -> Handler Text
--upload multipartData = do
-- liftIO $ do
-- putStrLn "Inputs:"
-- forM_ (inputs multipartData) $ \input ->
-- putStrLn $ " " <> show (iName input)
-- <> " -> " <> show (iValue input)
--
-- forM_ (files multipartData) $ \file -> do
-- content <- readFile (fdFilePath file)
-- putStrLn $ "Content of " <> show (fdFileName file)
-- <> " at " <> fdFilePath file
-- putStrLn content
-- pure (pack "Data loaded")
-------------------------------------------------------------------------------
type MetricsAPI = Summary "SepGen IncExc metrics" type MetricsAPI = Summary "SepGen IncExc metrics"
:> QueryParam "list" ListId :> QueryParam "list" ListId
:> QueryParamR "ngramsType" TabType :> QueryParamR "ngramsType" TabType
......
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