Commit a74ea59d authored by Grégoire Locqueville's avatar Grégoire Locqueville

Return Maybe (node ID) upon creating a subcorpus

parent f785e149
Pipeline #7070 canceled with stages
......@@ -22,11 +22,11 @@ makeSubcorpus :: ( HasNodeStoryEnv env
-> MakeSubcorpusAPI (AsServerT m)
makeSubcorpus user = MakeSubcorpusAPI $ \corpusId params -> do
case parseQuery (RawQuery $ _subcorpusParams_query params) of
Left _ -> return False
Left _ -> return Nothing
Right q -> do
_ <- makeSubcorpusFromQuery
subcorpusId <- makeSubcorpusFromQuery
(UserDBId user)
corpusId
q
(_subcorpusParams_reuseParentList params)
return True
return $ Just subcorpusId
......@@ -32,7 +32,7 @@ import Gargantext.API.Worker (WorkerAPI)
import Gargantext.Core.Text.Ngrams (NgramsType(..))
import Gargantext.Core.Utils.Prefix (unPrefix, unPrefixSwagger)
import Gargantext.Database.Admin.Types.Node
import Gargantext.Prelude (Bool)
import Gargantext.Prelude (Bool, Maybe)
import Servant
--------------------------------------------------
......@@ -68,7 +68,7 @@ newtype MakeSubcorpusAPI mode = MakeSubcorpusAPI
:> Capture "corpus_id" CorpusId
:> "subcorpus"
:> ReqBody '[JSON] SubcorpusParams
:> Post '[JSON] Bool -- was request successful
:> Post '[JSON] (Maybe NodeId) -- new subcorpus ID, if successful
} deriving Generic
data SubcorpusParams = SubcorpusParams
......
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