import Servant.Job.Utils (jsonOptions)
import Web.FormUrlEncoded (FromForm)
-import qualified Gargantext.API.Node.Corpus.New.File as NewFile
+import qualified Gargantext.API.Node.Corpus.New.Types as NewTypes
import Gargantext.API.Admin.Orchestrator.Types hiding (AsyncJobs)
import Gargantext.Core (Lang(..))
import Gargantext.Core.Utils.Prefix (unPrefixSwagger)
-import Gargantext.Database.Action.Flow (FlowCmdM) -- flowAnnuaire
+import Gargantext.Database.Action.Flow.Types (FlowCmdM) -- flowAnnuaire
import Gargantext.Database.Admin.Types.Node (AnnuaireId)
import Gargantext.Prelude
------------------------------------------------------------------------
------------------------------------------------------------------------
data AnnuaireWithForm = AnnuaireWithForm
- { _wf_filetype :: !NewFile.FileType
+ { _wf_filetype :: !NewTypes.FileType
, _wf_data :: !Text
, _wf_lang :: !(Maybe Lang)
} deriving (Eq, Show, Generic)
instance FromForm AnnuaireWithForm
instance FromJSON AnnuaireWithForm where
parseJSON = genericParseJSON $ jsonOptions "_wf_"
+instance ToJSON AnnuaireWithForm where
+ toJSON = genericToJSON $ jsonOptions "_wf_"
+
instance ToSchema AnnuaireWithForm where
declareNamedSchema = genericDeclareNamedSchema (unPrefixSwagger "_wf_")
-> AnnuaireWithForm
-> (JobLog -> m ())
-> m JobLog
-addToAnnuaireWithForm _cid (AnnuaireWithForm ft _d _l) logStatus = do
+addToAnnuaireWithForm _cid (AnnuaireWithForm { _wf_filetype }) logStatus = do
- printDebug "ft" ft
+ printDebug "ft" _wf_filetype
logStatus JobLog { _scst_succeeded = Just 1
- , _scst_failed = Just 0
- , _scst_remaining = Just 1
- , _scst_events = Just []
- }
+ , _scst_failed = Just 0
+ , _scst_remaining = Just 1
+ , _scst_events = Just []
+ }
pure JobLog { _scst_succeeded = Just 2
- , _scst_failed = Just 0
- , _scst_remaining = Just 0
- , _scst_events = Just []
- }
+ , _scst_failed = Just 0
+ , _scst_remaining = Just 0
+ , _scst_events = Just []
+ }