Commit e30519a3 authored by Alp Mestanogullari's avatar Alp Mestanogullari Committed by Przemyslaw Kaminski

fix build

parent c42e28fa
...@@ -191,7 +191,7 @@ serverGargAdminAPI = roots ...@@ -191,7 +191,7 @@ serverGargAdminAPI = roots
--gargMock :: Server GargAPI --gargMock :: Server GargAPI
--gargMock = mock apiGarg Proxy --gargMock = mock apiGarg Proxy
--------------------------------------------------------------------- ---------------------------------------------------------------------
makeApp :: EnvC env => env -> IO Application makeApp :: (Typeable env, EnvC env) => env -> IO Application
makeApp env = serveWithContext api cfg <$> server env makeApp env = serveWithContext api cfg <$> server env
where where
cfg :: Servant.Context AuthContext cfg :: Servant.Context AuthContext
......
...@@ -48,8 +48,8 @@ import Data.Text (Text) ...@@ -48,8 +48,8 @@ import Data.Text (Text)
import qualified Data.Text.Lazy as LT import qualified Data.Text.Lazy as LT
import Data.Text.Lazy.Encoding (decodeUtf8) import Data.Text.Lazy.Encoding (decodeUtf8)
import Data.Typeable (Typeable) import Data.Typeable (Typeable)
import Gargantext.API.Prelude (GargServer) import Gargantext.API.Prelude (GargServerT, GargM, GargError)
import Gargantext.Database.Prelude (Cmd) import Gargantext.Database.Prelude (Cmd, HasConnectionPool, HasConfig)
import Gargantext.Database.Query.Table.User (getUsersWithId) import Gargantext.Database.Query.Table.User (getUsersWithId)
import Gargantext.Database.Schema.User (UserPoly(..), UserLight) import Gargantext.Database.Schema.User (UserPoly(..), UserLight)
import GHC.Generics (Generic) import GHC.Generics (Generic)
...@@ -68,7 +68,7 @@ import Servant ...@@ -68,7 +68,7 @@ import Servant
PlainText, PlainText,
Post, Post,
ReqBody, ReqBody,
Server, ServerT,
) )
import Prelude import Prelude
...@@ -101,7 +101,9 @@ data Contet ...@@ -101,7 +101,9 @@ data Contet
-- | The main GraphQL resolver: how queries, mutations and -- | The main GraphQL resolver: how queries, mutations and
-- subscriptions are handled. -- subscriptions are handled.
rootResolver :: RootResolver _ EVENT Query Undefined Undefined rootResolver
:: (HasConnectionPool env, HasConfig env)
=> RootResolver (GargM env GargError) EVENT Query Undefined Undefined
rootResolver = rootResolver =
RootResolver RootResolver
{ queryResolver = Query { user = resolveUser } { queryResolver = Query { user = resolveUser }
...@@ -109,7 +111,9 @@ rootResolver = ...@@ -109,7 +111,9 @@ rootResolver =
, subscriptionResolver = Undefined } , subscriptionResolver = Undefined }
-- | Function to resolve user from a query. -- | Function to resolve user from a query.
resolveUser :: UserArgs -> ResolverQ e _ UserLight resolveUser
:: (HasConnectionPool env, HasConfig env)
=> UserArgs -> ResolverQ e (GargM env GargError) UserLight
resolveUser UserArgs { user_id } = do resolveUser UserArgs { user_id } = do
liftEither $ dbUser user_id liftEither $ dbUser user_id
-- user <- lift $ dbUser user_id -- user <- lift $ dbUser user_id
...@@ -127,7 +131,9 @@ dbUser user_id = do ...@@ -127,7 +131,9 @@ dbUser user_id = do
(user:_) -> pure $ Right user (user:_) -> pure $ Right user
-- | Main GraphQL "app". -- | Main GraphQL "app".
app :: App EVENT _ app
:: (Typeable env, HasConnectionPool env, HasConfig env)
=> App EVENT (GargM env GargError)
app = deriveApp rootResolver app = deriveApp rootResolver
---------------------------------------------- ----------------------------------------------
...@@ -165,8 +171,7 @@ type API = "gql" :> (GQAPI :<|> Playground) ...@@ -165,8 +171,7 @@ type API = "gql" :> (GQAPI :<|> Playground)
-- | Implementation of our API. -- | Implementation of our API.
--api :: Server API --api :: Server API
api :: GargServer API api
api = do :: (Typeable env, HasConnectionPool env, HasConfig env)
--(wsApp, publish') <- liftIO $ webSocketsApp app => ServerT API (GargM env GargError)
--(liftIO . httpPubApp [] app) :<|> pure httpPlayground api = httpPubApp [] app :<|> pure httpPlayground
(liftBase . httpPubApp [] app) :<|> pure httpPlayground
...@@ -53,7 +53,7 @@ serverGargAPI baseUrl -- orchestrator ...@@ -53,7 +53,7 @@ serverGargAPI baseUrl -- orchestrator
gargVersion = pure (cs $ showVersion PG.version) gargVersion = pure (cs $ showVersion PG.version)
-- | Server declarations -- | Server declarations
server :: forall env. EnvC env => env -> IO (Server API) server :: forall env. (Typeable env, EnvC env) => env -> IO (Server API)
server env = do server env = do
-- orchestrator <- scrapyOrchestrator env -- orchestrator <- scrapyOrchestrator env
pure $ swaggerSchemaUIServer swaggerDoc pure $ swaggerSchemaUIServer swaggerDoc
......
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