Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
157
Issues
157
List
Board
Labels
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
e30519a3
Commit
e30519a3
authored
Oct 08, 2021
by
Alp Mestanogullari
Committed by
Przemyslaw Kaminski
Oct 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix build
parent
c42e28fa
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
13 deletions
+18
-13
API.hs
src/Gargantext/API.hs
+1
-1
GraphQL.hs
src/Gargantext/API/GraphQL.hs
+16
-11
Server.hs
src/Gargantext/API/Server.hs
+1
-1
No files found.
src/Gargantext/API.hs
View file @
e30519a3
...
@@ -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
...
...
src/Gargantext/API/GraphQL.hs
View file @
e30519a3
...
@@ -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
(
GargServer
T
,
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
,
Server
T
,
)
)
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
src/Gargantext/API/Server.hs
View file @
e30519a3
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment