import qualified Gargantext.API.Public as Public
import Gargantext.API.Admin.Auth.Types (AuthContext)
-import Gargantext.API.Admin.Auth (auth)
+import Gargantext.API.Admin.Auth (auth, forgotPassword, forgotPasswordAsync)
+import Gargantext.API.Admin.EnvTypes (Env)
import Gargantext.API.Admin.FrontEnd (frontEndServer)
+import qualified Gargantext.API.GraphQL as GraphQL
import Gargantext.API.Prelude
import Gargantext.API.Routes
import Gargantext.API.Swagger (swaggerDoc)
import Gargantext.Prelude.Config (gc_url_backend_api)
-serverGargAPI :: MimeRender JSON err => Text -> GargServerM env err GargAPI
+serverGargAPI :: Text -> ServerT GargAPI (GargM Env GargError)
serverGargAPI baseUrl -- orchestrator
= auth
+ :<|> forgotPassword
+ :<|> forgotPasswordAsync
:<|> gargVersion
:<|> serverPrivateGargAPI
:<|> Public.api baseUrl
gargVersion = pure (cs $ showVersion PG.version)
-- | Server declarations
-server :: forall env. EnvC env => env -> IO (Server API)
+server :: Env -> IO (Server API)
server env = do
-- orchestrator <- scrapyOrchestrator env
pure $ swaggerSchemaUIServer swaggerDoc
(Proxy :: Proxy AuthContext)
transform
(serverGargAPI (env ^. hasConfig . gc_url_backend_api))
+ :<|> hoistServerWithContext
+ (Proxy :: Proxy GraphQL.API)
+ (Proxy :: Proxy AuthContext)
+ transform
+ GraphQL.api
:<|> frontEndServer
where
- transform :: forall a. GargM env GargError a -> Handler a
+ transform :: forall a. GargM Env GargError a -> Handler a
transform = Handler . withExceptT showAsServantErr . (`runReaderT` env)