Commit 50d10679 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[graphql] remove ethercalc endpoint

parent 4aaedab0
Pipeline #2202 failed with stage
in 10 minutes and 31 seconds
......@@ -33,7 +33,6 @@ import Gargantext.API.Admin.Auth.Types (AuthenticatedUser)
import Gargantext.API.Admin.Orchestrator.Types (JobLog)
import Gargantext.API.Prelude (HasJobEnv')
import qualified Gargantext.API.GraphQL.AsyncTask as GQLAT
import qualified Gargantext.API.GraphQL.Ethercalc as GQLEthercalc
import qualified Gargantext.API.GraphQL.Node as GQLNode
import qualified Gargantext.API.GraphQL.User as GQLUser
import qualified Gargantext.API.GraphQL.UserInfo as GQLUserInfo
......@@ -70,8 +69,7 @@ data Query m
data Mutation m
= Mutation
{ ethercalc_csv_download :: GQLEthercalc.EthercalcCSVDownloadArgs -> m Int
, update_user_info :: GQLUserInfo.UserInfoMArgs -> m Int }
{ update_user_info :: GQLUserInfo.UserInfoMArgs -> m Int }
deriving (Generic, GQLType)
-- | Possible GraphQL Events, i.e. here we describe how we will
......@@ -101,8 +99,7 @@ rootResolver =
, node_parent = GQLNode.resolveNodeParent
, user_infos = GQLUserInfo.resolveUserInfos
, users = GQLUser.resolveUsers }
, mutationResolver = Mutation { ethercalc_csv_download = GQLEthercalc.ethercalcCSVDownload
, update_user_info = GQLUserInfo.updateUserInfo }
, mutationResolver = Mutation { update_user_info = GQLUserInfo.updateUserInfo }
, subscriptionResolver = Undefined }
-- | Main GraphQL "app".
......
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DuplicateRecordFields #-}
module Gargantext.API.GraphQL.Ethercalc where
import Control.Lens ((^.))
import Data.Either (Either(..))
import Data.Morpheus.Types
( GQLType
, Resolver
, ResolverM
, QUERY
, lift
)
import Data.Text (Text)
import qualified Data.Text as T
import Gargantext.API.Job (jobLogInit)
import qualified Gargantext.API.Node.Corpus.New as New
import Gargantext.API.Prelude (GargM, GargServerT, GargError)
import Gargantext.Core.Mail.Types (HasMail)
import Gargantext.Core.Types (NodeId(..))
import Gargantext.Database.Admin.Types.Node (NodeId(..), NodeType)
import Gargantext.Database.Admin.Types.Hyperdata (HyperdataFrame, getHyperdataFrameCSV)
import qualified Gargantext.Database.Admin.Types.Node as NN
import Gargantext.Database.Query.Table.Node (getClosestParentIdByType, getNode, getNodeWith)
import Gargantext.Database.Prelude (HasConnectionPool, HasConfig)
import qualified Gargantext.Database.Schema.Node as N
import Gargantext.Prelude
import GHC.Generics (Generic)
import qualified Prelude as Prelude
import Servant (Proxy(..))
import Servant.Job.Async (serveJobsAPI, JobFunction(..))
import Text.Read (readEither)
data EthercalcCSVDownload = EthercalcCSVDownload
{ corpusId :: Int
, nodeId :: Int
} deriving (Show, Generic, GQLType)
data EthercalcCSVDownloadArgs
= EthercalcCSVDownloadArgs
{ corpusId :: Int
, nodeId :: Int
} deriving (Generic, GQLType)
type GqlM e env = Resolver QUERY e (GargM env GargError)
-- | Function to resolve user from a query.
ethercalcCSVDownload
:: (HasConnectionPool env, HasConfig env, HasMail env)
=> EthercalcCSVDownloadArgs -> ResolverM e (GargM env GargError) Int
ethercalcCSVDownload (EthercalcCSVDownloadArgs { corpusId, nodeId }) = do
ret <- lift $ do
frameCalc <- getNodeWith (NodeId nodeId) (Proxy :: Proxy HyperdataFrame)
printDebug "[ethercalcCSVDownload] frameCalc" frameCalc
csv <- liftBase $ getHyperdataFrameCSV (frameCalc ^. N.node_hyperdata)
printDebug "[ethercalcCSVDownload] csv" csv
serveJobsAPI $
JobFunction (\i log' ->
let
log'' x = do
printDebug "[ethercalcCSVDownload] " x
liftBase $ log' x
in New.addToCorpusWithForm user corpusId i log'' (jobLogInit 3))
lift $ printDebug "[ethercalcCSVDownload] ret" ret
pure 0
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