-
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
122 additions
and
127 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
"""Common GraphQL types.""" | ||
|
||
from graphene_django import DjangoObjectType | ||
|
||
|
||
class BaseNode(DjangoObjectType): | ||
"""Base node.""" | ||
|
||
class Meta: | ||
abstract = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"""Common GraphQL queries.""" | ||
|
||
import graphene | ||
|
||
|
||
class BaseQuery(graphene.ObjectType): | ||
"""Base GraphQL query.""" |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"""GitHub issue GraphQL types.""" | ||
|
||
from apps.common.graphql.nodes import BaseNode | ||
from apps.github.models.issue import Issue | ||
|
||
|
||
class IssueNode(BaseNode): | ||
"""GitHub issue.""" | ||
|
||
class Meta: | ||
model = Issue | ||
fields = ( | ||
"author", | ||
"comments_count", | ||
"created_at", | ||
"number", | ||
"state", | ||
"title", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"""GitHub release GraphQL types.""" | ||
|
||
from graphene import Field | ||
|
||
from apps.common.graphql.nodes import BaseNode | ||
from apps.github.graphql.nodes.user import UserNode | ||
from apps.github.models.release import Release | ||
|
||
|
||
class ReleaseNode(BaseNode): | ||
"""GitHub release.""" | ||
|
||
author = Field(UserNode) | ||
|
||
class Meta: | ||
model = Release | ||
fields = ( | ||
"author", | ||
"is_pre_release", | ||
"name", | ||
"published_at", | ||
"tag_name", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"""GitHub user GraphQL types.""" | ||
|
||
from apps.common.graphql.nodes import BaseNode | ||
from apps.github.models.user import User | ||
|
||
|
||
class UserNode(BaseNode): | ||
"""GitHub user.""" | ||
|
||
class Meta: | ||
model = User | ||
fields = ( | ||
"avatar_url", | ||
"email", | ||
"id", | ||
"login", | ||
"name", | ||
) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
36 changes: 9 additions & 27 deletions
36
backend/apps/owasp/graphql/types/project.py → backend/apps/owasp/graphql/nodes/project.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from apps.owasp.graphql.queries.project import ProjectQueries | ||
from apps.owasp.graphql.queries.project import ProjectQuery | ||
|
||
|
||
class OWASPQuery(ProjectQueries): | ||
"""GraphQL query class for OWASP-related queries.""" | ||
class OwaspQuery(ProjectQuery): | ||
"""GraphQL query class for owasp app queries.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
"""Defines the GraphQL queries for OWASP projects.""" | ||
"""OWASP project GraphQL queries.""" | ||
|
||
import graphene | ||
|
||
from apps.owasp.graphql.types.project import ProjectType | ||
from apps.common.graphql.queries import BaseQuery | ||
from apps.owasp.graphql.nodes.project import ProjectNode | ||
from apps.owasp.models.project import Project | ||
|
||
|
||
class ProjectQueries(graphene.ObjectType): | ||
"""GraphQL queries for OWASP projects.""" | ||
class ProjectQuery(BaseQuery): | ||
"""Project GraphQL queries.""" | ||
|
||
project = graphene.Field(ProjectType, key=graphene.String()) | ||
project = graphene.Field(ProjectNode, key=graphene.String(required=True)) | ||
|
||
def resolve_project(self, info, key=None): | ||
"""Resolve a project by its key.""" | ||
if key: | ||
def resolve_project(root, info, key): | ||
"""Resolve project by key.""" | ||
try: | ||
return Project.objects.get(key=key) | ||
return None | ||
except Project.DoesNotExist: | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
"""Defines the GraphQL schema for the application.""" | ||
"""Nest GraphQL schema.""" | ||
|
||
import graphene | ||
|
||
from apps.common.schema import BaseQuery | ||
from apps.owasp.graphql.queries import OWASPQuery | ||
from apps.owasp.graphql.queries import OwaspQuery | ||
|
||
|
||
class Query(BaseQuery, OWASPQuery): | ||
"""Combines base and OWASP queries.""" | ||
class Query(OwaspQuery): | ||
"""Schema queries.""" | ||
|
||
|
||
schema = graphene.Schema(query=Query) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
VITE_ALGOLIA_APP_ID=your-algolia-app-id | ||
VITE_ALGOLIA_SEARCH_API_KEY=your-algolia-search-api-key | ||
VITE_API_URL=http://localhost:8000/api/v1 | ||
VITE_API_URL=http://localhost:8000/api/v1/ | ||
VITE_ENVIRONMENT=local | ||
VITE_GRAPHQL_URL=http://localhost:8000/graphql/ | ||
VITE_GTM_AUTH=your-google-tag-manager-auth | ||
VITE_GTM_ID=your-google-tag-manager-id | ||
VITE_GTM_PREVIEW= | ||
VITE_RELEASE_VERSION= | ||
VITE_SENTRY_DSN= | ||
VITE_GRAPHQL_URI=http://localhost:8000/graphql/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.