Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Przemyslaw Kaminski
haskell-gargantext
Commits
9f9a8071
Commit
9f9a8071
authored
Jun 24, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] API post with param.
parent
8a09010d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
Node.hs
src/Gargantext/API/Node.hs
+17
-4
No files found.
src/Gargantext/API/Node.hs
View file @
9f9a8071
...
...
@@ -399,11 +399,24 @@ getMetrics cId maybeListId tabType maybeLimit = do
-------------------------------------------------------------
type
Hash
=
Text
data
FileType
=
CSV
|
PresseRIS
deriving
(
Eq
,
Show
)
deriving
(
Eq
,
Show
,
Generic
)
instance
ToSchema
FileType
instance
Arbitrary
FileType
where
arbitrary
=
elements
[
CSV
,
PresseRIS
]
instance
ToParamSchema
FileType
instance
ToParamSchema
(
MultipartData
Mem
)
where
toParamSchema
_
=
toParamSchema
(
Proxy
::
Proxy
TODO
)
instance
FromHttpApiData
FileType
where
parseUrlPiece
"CSV"
=
pure
CSV
parseUrlPiece
"PresseRis"
=
pure
PresseRIS
parseUrlPiece
_
=
pure
CSV
-- TODO error here
instance
(
ToParamSchema
a
,
HasSwagger
sub
)
=>
HasSwagger
(
MultipartForm
tag
a
:>
sub
)
where
-- TODO
...
...
@@ -424,9 +437,9 @@ type UploadAPI = Summary "Upload file(s) to a corpus"
--postUpload :: NodeId -> Maybe FileType -> GargServer UploadAPI
--postUpload :: NodeId -> GargServer UploadAPI
postUpload
::
NodeId
->
M
aybe
FileType
->
MultipartData
Mem
->
Cmd
err
[
Hash
]
postUpload
_
Nothing
_
=
panic
"fileType is a required parameter"
postUpload
_
(
Just
fileType
)
multipartData
=
do
postUpload
::
NodeId
->
M
ultipartData
Mem
->
Maybe
FileType
->
Cmd
err
[
Hash
]
postUpload
_
_
Nothing
=
panic
"fileType is a required parameter"
postUpload
_
multipartData
(
Just
fileType
)
=
do
putStrLn
$
"File Type: "
<>
(
show
fileType
)
is
<-
liftIO
$
do
putStrLn
(
"Inputs:"
::
Text
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment