Commit 8a09010d authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

upload: some attempts to add query param "fileType" to upload api

parent 7d6d74c4
......@@ -398,6 +398,8 @@ getMetrics cId maybeListId tabType maybeLimit = do
-------------------------------------------------------------
type Hash = Text
data FileType = CSV | PresseRIS
deriving (Eq, Show)
instance ToParamSchema (MultipartData Mem) where
toParamSchema _ = toParamSchema (Proxy :: Proxy TODO)
......@@ -417,10 +419,15 @@ instance (ToParamSchema a, HasSwagger sub) =>
type UploadAPI = Summary "Upload file(s) to a corpus"
:> MultipartForm Mem (MultipartData Mem)
:> QueryParam "fileType" FileType
:> Post '[JSON] [Hash]
postUpload :: NodeId -> GargServer UploadAPI
postUpload _ multipartData = do
--postUpload :: NodeId -> Maybe FileType -> GargServer UploadAPI
--postUpload :: NodeId -> GargServer UploadAPI
postUpload :: NodeId -> Maybe FileType -> MultipartData Mem -> Cmd err [Hash]
postUpload _ Nothing _ = panic "fileType is a required parameter"
postUpload _ (Just fileType) multipartData = do
putStrLn $ "File Type: " <> (show fileType)
is <- liftIO $ do
putStrLn ("Inputs:" :: Text)
forM (inputs multipartData) $ \input -> do
......
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