Skip to content

Commit

Permalink
feat: configure quibs api viewset and endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
moonlitgrace committed Dec 10, 2024
1 parent 11997c4 commit 06a7045
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 1 deletion.
Empty file.
Empty file.
9 changes: 9 additions & 0 deletions backend/apps/quib/api/v1/serializers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from rest_framework import serializers

from apps.quib.models import Quib


class QuibSerializer(serializers.ModelSerializer):
class Meta:
model = Quib
fields = '__all__'
8 changes: 8 additions & 0 deletions backend/apps/quib/api/v1/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from rest_framework import routers

from .viewsets import QuibViewSet

router = routers.DefaultRouter()
router.register(r'', QuibViewSet)

urlpatterns = router.urls
10 changes: 10 additions & 0 deletions backend/apps/quib/api/v1/viewsets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from rest_framework import viewsets

from apps.quib.models import Quib

from .serializers import QuibSerializer


class QuibViewSet(viewsets.ModelViewSet):
queryset = Quib.objects.all()
serializer_class = QuibSerializer
3 changes: 2 additions & 1 deletion backend/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
[
path('users/', include('apps.user.api.v1.urls')),
path('quiblets/', include('apps.quiblet.api.v1.urls')),
path('quibs/', include('apps.quib.api.v1.urls')),
]
),
),
# openapi
path('api/v1/schema/', SpectacularAPIView.as_view(), name='schema'),
path('api/v1/schema/', SpectacularAPIView.as_view(api_version='v1'), name='schema'),
]

# only add swagger ui for development
Expand Down

0 comments on commit 06a7045

Please sign in to comment.