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

[API][Node] corpus/<corpusId>/add/file endpoint

parent aa986303
...@@ -142,7 +142,7 @@ type NodeAPI a = Get '[JSON] (Node a) ...@@ -142,7 +142,7 @@ type NodeAPI a = Get '[JSON] (Node a)
:<|> "pie" :> PieApi :<|> "pie" :> PieApi
:<|> "tree" :> TreeApi :<|> "tree" :> TreeApi
:<|> "phylo" :> PhyloAPI :<|> "phylo" :> PhyloAPI
:<|> "upload" :> UploadAPI :<|> "add" :> NodeAddAPI
-- TODO-ACCESS: check userId CanRenameNode nodeId -- TODO-ACCESS: check userId CanRenameNode nodeId
-- TODO-EVENTS: NodeRenamed RenameNode or re-use some more general NodeEdited... -- TODO-EVENTS: NodeRenamed RenameNode or re-use some more general NodeEdited...
...@@ -199,7 +199,8 @@ nodeAPI p uId id = withAccess (Proxy :: Proxy (NodeAPI a)) Proxy uId (PathNode i ...@@ -199,7 +199,8 @@ nodeAPI p uId id = withAccess (Proxy :: Proxy (NodeAPI a)) Proxy uId (PathNode i
:<|> getPie id :<|> getPie id
:<|> getTree id :<|> getTree id
:<|> phyloAPI id uId :<|> phyloAPI id uId
:<|> postUpload id :<|> nodeAddAPI id
-- :<|> postUpload id
deleteNodeApi id' = do deleteNodeApi id' = do
node <- getNode' id' node <- getNode' id'
...@@ -375,6 +376,12 @@ instance (ToParamSchema a, HasSwagger sub) => ...@@ -375,6 +376,12 @@ instance (ToParamSchema a, HasSwagger sub) =>
& in_ .~ ParamFormData & in_ .~ ParamFormData
& paramSchema .~ toParamSchema (Proxy :: Proxy a) & paramSchema .~ toParamSchema (Proxy :: Proxy a)
type NodeAddAPI = "file" :> Summary "Node add API"
:> UploadAPI
nodeAddAPI :: NodeId -> GargServer NodeAddAPI
nodeAddAPI id = postUpload id
type UploadAPI = Summary "Upload file(s) to a corpus" type UploadAPI = Summary "Upload file(s) to a corpus"
:> MultipartForm Mem (MultipartData Mem) :> MultipartForm Mem (MultipartData Mem)
:> QueryParam "fileType" FileType :> QueryParam "fileType" FileType
......
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