-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
20 changed files
with
423 additions
and
5 deletions.
There are no files selected for viewing
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,8 @@ | ||
"""GitHub app API.""" | ||
|
||
from apps.github.api.issue import IssueViewSet | ||
from apps.github.api.label import LabelViewSet | ||
from apps.github.api.organization import OrganizationViewSet | ||
from apps.github.api.release import ReleaseViewSet | ||
from apps.github.api.repository import RepositoryViewSet | ||
from apps.github.api.user import UserViewSet |
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,29 @@ | ||
"""Issue API.""" | ||
|
||
from rest_framework import serializers, viewsets | ||
|
||
from apps.github.models import Issue | ||
|
||
|
||
# Serializers define the API representation. | ||
class IssueSerializer(serializers.HyperlinkedModelSerializer): | ||
"""Issue serializer.""" | ||
|
||
class Meta: | ||
model = Issue | ||
fields = ( | ||
"title", | ||
"body", | ||
"state", | ||
"url", | ||
"created_at", | ||
"updated_at", | ||
) | ||
|
||
|
||
# ViewSets define the view behavior. | ||
class IssueViewSet(viewsets.ReadOnlyModelViewSet): | ||
"""Issue view set.""" | ||
|
||
queryset = Issue.objects.all() | ||
serializer_class = IssueSerializer |
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,28 @@ | ||
"""Label API.""" | ||
|
||
from rest_framework import serializers, viewsets | ||
|
||
from apps.github.models import Label | ||
|
||
|
||
# Serializers define the API representation. | ||
class LabelSerializer(serializers.HyperlinkedModelSerializer): | ||
"""Label serializer.""" | ||
|
||
class Meta: | ||
model = Label | ||
fields = ( | ||
"name", | ||
"description", | ||
"color", | ||
"created_at", | ||
"updated_at", | ||
) | ||
|
||
|
||
# ViewSets define the view behavior. | ||
class LabelViewSet(viewsets.ReadOnlyModelViewSet): | ||
"""Label view set.""" | ||
|
||
queryset = Label.objects.all() | ||
serializer_class = LabelSerializer |
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,29 @@ | ||
"""Organization API.""" | ||
|
||
from rest_framework import serializers, viewsets | ||
|
||
from apps.github.models import Organization | ||
|
||
|
||
# Serializers define the API representation. | ||
class OrganizationSerializer(serializers.HyperlinkedModelSerializer): | ||
"""Organization serializer.""" | ||
|
||
class Meta: | ||
model = Organization | ||
fields = ( | ||
"name", | ||
"login", | ||
"company", | ||
"location", | ||
"created_at", | ||
"updated_at", | ||
) | ||
|
||
|
||
# ViewSets define the view behavior. | ||
class OrganizationViewSet(viewsets.ReadOnlyModelViewSet): | ||
"""Organization view set.""" | ||
|
||
queryset = Organization.objects.all() | ||
serializer_class = OrganizationSerializer |
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,28 @@ | ||
"""Release API.""" | ||
|
||
from rest_framework import serializers, viewsets | ||
|
||
from apps.github.models import Release | ||
|
||
|
||
# Serializers define the API representation. | ||
class ReleaseSerializer(serializers.HyperlinkedModelSerializer): | ||
"""Release serializer.""" | ||
|
||
class Meta: | ||
model = Release | ||
fields = ( | ||
"name", | ||
"tag_name", | ||
"description", | ||
"created_at", | ||
"published_at", | ||
) | ||
|
||
|
||
# ViewSets define the view behavior. | ||
class ReleaseViewSet(viewsets.ReadOnlyModelViewSet): | ||
"""Release view set.""" | ||
|
||
queryset = Release.objects.all() | ||
serializer_class = ReleaseSerializer |
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,27 @@ | ||
"""Repository API.""" | ||
|
||
from rest_framework import serializers, viewsets | ||
|
||
from apps.github.models import Repository | ||
|
||
|
||
# Serializers define the API representation. | ||
class RepositorySerializer(serializers.HyperlinkedModelSerializer): | ||
"""Repository serializer.""" | ||
|
||
class Meta: | ||
model = Repository | ||
fields = ( | ||
"name", | ||
"description", | ||
"created_at", | ||
"updated_at", | ||
) | ||
|
||
|
||
# ViewSets define the view behavior. | ||
class RepositoryViewSet(viewsets.ReadOnlyModelViewSet): | ||
"""Repository view set.""" | ||
|
||
queryset = Repository.objects.all() | ||
serializer_class = RepositorySerializer |
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,21 @@ | ||
"""GitHub API URLs.""" | ||
|
||
from rest_framework import routers | ||
|
||
from apps.github.api import ( | ||
IssueViewSet, | ||
LabelViewSet, | ||
OrganizationViewSet, | ||
ReleaseViewSet, | ||
RepositoryViewSet, | ||
UserViewSet, | ||
) | ||
|
||
router = routers.SimpleRouter() | ||
|
||
router.register(r"github/issues", IssueViewSet) | ||
router.register(r"github/labels", LabelViewSet) | ||
router.register(r"github/organizations", OrganizationViewSet) | ||
router.register(r"github/releases", ReleaseViewSet) | ||
router.register(r"github/repositories", RepositoryViewSet) | ||
router.register(r"github/users", UserViewSet) |
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,29 @@ | ||
"""User API.""" | ||
|
||
from rest_framework import serializers, viewsets | ||
|
||
from apps.github.models import User | ||
|
||
|
||
# Serializers define the API representation. | ||
class UserSerializer(serializers.HyperlinkedModelSerializer): | ||
"""User serializer.""" | ||
|
||
class Meta: | ||
model = User | ||
fields = ( | ||
"name", | ||
"login", | ||
"company", | ||
"location", | ||
"created_at", | ||
"updated_at", | ||
) | ||
|
||
|
||
# ViewSets define the view behavior. | ||
class UserViewSet(viewsets.ReadOnlyModelViewSet): | ||
"""User view set.""" | ||
|
||
queryset = User.objects.all() | ||
serializer_class = UserSerializer |
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,17 @@ | ||
# Generated by Django 5.1.1 on 2024-09-04 22:52 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("github", "0038_remove_issue_assignee_issue_closed_at_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="issue", | ||
name="title", | ||
field=models.CharField(max_length=300, verbose_name="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
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,6 @@ | ||
"""OWASP app API.""" | ||
|
||
from apps.owasp.api.chapter import ChapterViewSet | ||
from apps.owasp.api.committee import CommitteeViewSet | ||
from apps.owasp.api.event import EventViewSet | ||
from apps.owasp.api.project import ProjectViewSet |
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,28 @@ | ||
"""Chapter API.""" | ||
|
||
from rest_framework import serializers, viewsets | ||
|
||
from apps.owasp.models import Chapter | ||
|
||
|
||
# Serializers define the API representation. | ||
class ChapterSerializer(serializers.HyperlinkedModelSerializer): | ||
"""Chapter serializer.""" | ||
|
||
class Meta: | ||
model = Chapter | ||
fields = ( | ||
"name", | ||
"country", | ||
"region", | ||
"created_at", | ||
"updated_at", | ||
) | ||
|
||
|
||
# ViewSets define the view behavior. | ||
class ChapterViewSet(viewsets.ReadOnlyModelViewSet): | ||
"""Chapter view set.""" | ||
|
||
queryset = Chapter.objects.all() | ||
serializer_class = ChapterSerializer |
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,27 @@ | ||
"""Committee API.""" | ||
|
||
from rest_framework import serializers, viewsets | ||
|
||
from apps.owasp.models import Committee | ||
|
||
|
||
# Serializers define the API representation. | ||
class CommitteeSerializer(serializers.HyperlinkedModelSerializer): | ||
"""Committee serializer.""" | ||
|
||
class Meta: | ||
model = Committee | ||
fields = ( | ||
"name", | ||
"description", | ||
"created_at", | ||
"updated_at", | ||
) | ||
|
||
|
||
# ViewSets define the view behavior. | ||
class CommitteeViewSet(viewsets.ReadOnlyModelViewSet): | ||
"""Committee view set.""" | ||
|
||
queryset = Committee.objects.all() | ||
serializer_class = CommitteeSerializer |
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,28 @@ | ||
"""Event API.""" | ||
|
||
from rest_framework import serializers, viewsets | ||
|
||
from apps.owasp.models import Event | ||
|
||
|
||
# Serializers define the API representation. | ||
class EventSerializer(serializers.HyperlinkedModelSerializer): | ||
"""Event serializer.""" | ||
|
||
class Meta: | ||
model = Event | ||
fields = ( | ||
"name", | ||
"description", | ||
"url", | ||
"created_at", | ||
"updated_at", | ||
) | ||
|
||
|
||
# ViewSets define the view behavior. | ||
class EventViewSet(viewsets.ReadOnlyModelViewSet): | ||
"""Event view set.""" | ||
|
||
queryset = Event.objects.all() | ||
serializer_class = EventSerializer |
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,28 @@ | ||
"""Project API.""" | ||
|
||
from rest_framework import serializers, viewsets | ||
|
||
from apps.owasp.models import Project | ||
|
||
|
||
# Serializers define the API representation. | ||
class ProjectSerializer(serializers.HyperlinkedModelSerializer): | ||
"""Project serializer.""" | ||
|
||
class Meta: | ||
model = Project | ||
fields = ( | ||
"name", | ||
"description", | ||
"level", | ||
"created_at", | ||
"updated_at", | ||
) | ||
|
||
|
||
# ViewSets define the view behavior. | ||
class ProjectViewSet(viewsets.ReadOnlyModelViewSet): | ||
"""Project view set.""" | ||
|
||
queryset = Project.objects.all() | ||
serializer_class = ProjectSerializer |
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,17 @@ | ||
"""GitHub API URLs.""" | ||
|
||
from rest_framework import routers | ||
|
||
from apps.owasp.api import ( | ||
ChapterViewSet, | ||
CommitteeViewSet, | ||
EventViewSet, | ||
ProjectViewSet, | ||
) | ||
|
||
router = routers.SimpleRouter() | ||
|
||
router.register(r"owasp/chapters", ChapterViewSet) | ||
router.register(r"owasp/committees", CommitteeViewSet) | ||
router.register(r"owasp/events", EventViewSet) | ||
router.register(r"owasp/projects", ProjectViewSet) |
Oops, something went wrong.