-
-
Notifications
You must be signed in to change notification settings - Fork 629
Expand file tree
/
Copy pathgraphql.py
More file actions
50 lines (40 loc) · 1.31 KB
/
graphql.py
File metadata and controls
50 lines (40 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""GraphQL schema."""
import strawberry
from django.conf import settings
from strawberry.extensions import DisableIntrospection, QueryDepthLimiter
from strawberry_django.optimizer import DjangoOptimizerExtension
from apps.api.internal.mutations import ApiMutations
from apps.api.internal.queries import ApiKeyQueries
from apps.github.api.internal.queries import GithubQuery
from apps.mentorship.api.internal.mutations import (
ModuleMutation,
ProgramMutation,
)
from apps.mentorship.api.internal.queries import (
MentorshipQuery,
ModuleQuery,
ProgramQuery,
)
from apps.nest.api.internal.mutations import NestMutations
from apps.owasp.api.internal.mutations import SponsorMutation
from apps.owasp.api.internal.queries import OwaspQuery
@strawberry.type
class Mutation(ApiMutations, ModuleMutation, NestMutations, ProgramMutation, SponsorMutation):
"""Schema mutations."""
@strawberry.type
class Query(
ApiKeyQueries,
GithubQuery,
MentorshipQuery,
ModuleQuery,
OwaspQuery,
ProgramQuery,
):
"""Schema queries."""
extensions = [
QueryDepthLimiter(max_depth=5),
DjangoOptimizerExtension(),
]
if not settings.DEBUG and not settings.IS_FUZZ_ENVIRONMENT:
extensions.append(DisableIntrospection())
schema = strawberry.Schema(extensions=extensions, mutation=Mutation, query=Query)