Commit 7c715e7c authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch '81-dev-zip-upload' of...

Merge branch '81-dev-zip-upload' of ssh://gitlab.iscpif.fr:20022/gargantext/haskell-gargantext into dev-merge
parents 27fab5b6 36b1f7eb
...@@ -257,6 +257,7 @@ addToCorpusWithForm user cid (NewWithForm ft d l _n) logStatus jobLog = do ...@@ -257,6 +257,7 @@ addToCorpusWithForm user cid (NewWithForm ft d l _n) logStatus jobLog = do
CSV -> Parser.parseFormat Parser.CsvGargV3 CSV -> Parser.parseFormat Parser.CsvGargV3
WOS -> Parser.parseFormat Parser.WOS WOS -> Parser.parseFormat Parser.WOS
PresseRIS -> Parser.parseFormat Parser.RisPresse PresseRIS -> Parser.parseFormat Parser.RisPresse
ZIP -> Parser.parseFormat Parser.ZIP
-- TODO granularity of the logStatus -- TODO granularity of the logStatus
eDocs <- liftBase $ parse $ cs d eDocs <- liftBase $ parse $ cs d
...@@ -370,3 +371,4 @@ addToCorpusWithFile user cid nwf@(NewWithFile _d _l fName) logStatus = do ...@@ -370,3 +371,4 @@ addToCorpusWithFile user cid nwf@(NewWithFile _d _l fName) logStatus = do
, _scst_remaining = Just 0 , _scst_remaining = Just 0
, _scst_events = Just [] , _scst_events = Just []
} }
...@@ -45,25 +45,24 @@ data FileType = CSV ...@@ -45,25 +45,24 @@ data FileType = CSV
| CSV_HAL | CSV_HAL
| PresseRIS | PresseRIS
| WOS | WOS
| ZIP
deriving (Eq, Show, Generic) deriving (Eq, Show, Generic)
instance ToSchema FileType instance ToSchema FileType
instance Arbitrary FileType instance Arbitrary FileType where arbitrary = elements [CSV, PresseRIS]
where
arbitrary = elements [CSV, PresseRIS]
instance ToParamSchema FileType instance ToParamSchema FileType
instance FromJSON FileType instance FromJSON FileType
instance ToJSON FileType instance ToJSON FileType
instance ToParamSchema (MultipartData Mem) where instance ToParamSchema (MultipartData Mem) where toParamSchema _ = toParamSchema (Proxy :: Proxy TODO)
toParamSchema _ = toParamSchema (Proxy :: Proxy TODO)
instance FromHttpApiData FileType instance FromHttpApiData FileType
where where
parseUrlPiece "CSV" = pure CSV parseUrlPiece "CSV" = pure CSV
parseUrlPiece "CSV_HAL" = pure CSV_HAL parseUrlPiece "CSV_HAL" = pure CSV_HAL
parseUrlPiece "PresseRis" = pure PresseRIS parseUrlPiece "PresseRis" = pure PresseRIS
parseUrlPiece "ZIP" = pure ZIP
parseUrlPiece _ = pure CSV -- TODO error here parseUrlPiece _ = pure CSV -- TODO error here
......
...@@ -68,6 +68,7 @@ type ParseError = String ...@@ -68,6 +68,7 @@ type ParseError = String
-- different parser are available. -- different parser are available.
data FileFormat = WOS | RIS | RisPresse data FileFormat = WOS | RIS | RisPresse
| CsvGargV3 | CsvHal | CsvGargV3 | CsvHal
| ZIP
deriving (Show) deriving (Show)
-- Implemented (ISI Format) -- Implemented (ISI Format)
...@@ -94,6 +95,9 @@ parseFormat WOS bs = do ...@@ -94,6 +95,9 @@ parseFormat WOS bs = do
$ partitionEithers $ partitionEithers
$ [runParser' WOS bs] $ [runParser' WOS bs]
pure $ Right docs pure $ Right docs
parseFormat ZIP _bs = do
printDebug "[parseFormat]" ZIP
pure $ Left "Not implemented for ZIP"
parseFormat _ _ = undefined parseFormat _ _ = undefined
-- | Parse file into documents -- | Parse file into documents
......
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