Skip to content

Commit

Permalink
Merge pull request #73 from resum-ai/feat/resume
Browse files Browse the repository at this point in the history
fix: add logger
  • Loading branch information
yjoonjang authored Apr 6, 2024
2 parents eec6dcd + 08e268f commit 482acba
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
3 changes: 3 additions & 0 deletions accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,22 @@ def kakao_login(request):
@api_view(["GET"])
def kakao_callback(request):
code = request.GET.get("code")
logger.info(code)

# Access Token Request
token_req = requests.get(
f"https://kauth.kakao.com/oauth/token?grant_type=authorization_code&client_id={REST_API_KEY}&client_secret={CLIENT_SECRET}&redirect_uri={KAKAO_CALLBACK_URI}&code={code}"
)

token_req_json = token_req.json()
logger.info(token_req_json)

error = token_req_json.get("error")
if error is not None:
raise JSONDecodeError(error)

access_token = token_req_json.get("access_token")
logger.info(access_token)

# Email Request
profile_request = requests.get(
Expand Down
1 change: 1 addition & 0 deletions resume/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@


urlpatterns = [
path("all/", views.GetAllResumeView.as_view(), name="get_all_resume"),
path("guidelines/", views.GetGuidelinesView.as_view(), name="get_guidelines"),
path("generate/", views.GenerateResumeView.as_view(), name="generate_resume"),
path("", views.PostResumeView.as_view(), name="post_resume"),
Expand Down
32 changes: 32 additions & 0 deletions resume/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,38 @@
from utils.prompts import GUIDELINE_PROMPT, GENERATE_SELF_INTRODUCTION_PROMPT


class GetAllResumeView(APIView, PageNumberPagination):
permission_classes = [IsAuthenticated]

@extend_schema(
summary="전체 자기소개서를 받아옵니다.",
description="사용자가 작성한 전체 자기소개서를 받아옵니다.",
responses={
200: inline_serializer(
name="GetAllResumeResponse",
fields={
"count": serializers.IntegerField(),
"next": serializers.URLField(),
"previous": serializers.URLField(),
"results": PostResumeSerializer(many=True),
},
)
},
)
def get(self, request):
# 현재 인증된 유저에게 속한 메모들을 조회
resumes = Resume.objects.filter(user=request.user)

# Pagination 적용
page = self.paginate_queryset(resumes, request, view=self)
if page is not None:
serializer = PostResumeSerializer(page, many=True)
return self.get_paginated_response(serializer.data)

# Pagination이 적용되지 않은 경우(선택적)
serializer = PostResumeSerializer(resumes, many=True)
return Response(serializer.data)

# Create your views here.
class GetGuidelinesView(APIView):
permission_classes = [IsAuthenticated]
Expand Down

0 comments on commit 482acba

Please sign in to comment.