Skip to content

Commit

Permalink
♻️Refact : likes api에 대한 swagger 적용 #11
Browse files Browse the repository at this point in the history
- api 문서화를 위한 swagger 적용

Related to #11
  • Loading branch information
Chestnut90 committed Oct 26, 2023
1 parent 88ac02b commit e7ed99b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions likes/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from django.shortcuts import get_object_or_404
from drf_yasg import openapi
from drf_yasg.utils import swagger_auto_schema
from rest_framework.permissions import IsAuthenticatedOrReadOnly
from rest_framework.response import Response
from rest_framework.status import HTTP_200_OK, HTTP_401_UNAUTHORIZED
from rest_framework.views import APIView

from likes.serializers import PostLikeIncrementSerializer
Expand All @@ -10,6 +13,13 @@
class LikesAPIView(APIView):
permission_classes = [IsAuthenticatedOrReadOnly]

@swagger_auto_schema(
operation_summary="게시물에 좋아요",
responses={
HTTP_200_OK: openapi.Response(description="ok"),
HTTP_401_UNAUTHORIZED: openapi.Response(description="unauthorized"),
},
)
def post(self, request, content_id):
post = get_object_or_404(Post, content_id=content_id)

Expand Down

0 comments on commit e7ed99b

Please sign in to comment.