Skip to content

Commit

Permalink
Feat: 채택시 포인트 제공
Browse files Browse the repository at this point in the history
  • Loading branch information
yigang.jo committed Jan 24, 2025
1 parent 927f2da commit 13c8cca
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion KUA/student/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ class PointGetView(APIView):
type=openapi.TYPE_OBJECT,
properties={
'point_type': openapi.Schema(type=openapi.TYPE_STRING),
'student_id' : openapi.Schema(type=openapi.TYPE_INTEGER),
}
),
responses={
Expand All @@ -307,8 +308,12 @@ class PointGetView(APIView):
}
)
def post(self, request): # If using UpdateAPIView, consider using put or patch
user = request.user
point_type = request.data.get('point_type')
if point_type == 'chosen':
student_id = request.data.get('student_id')
user = models.User.objects.get(id=student_id)
else:
user = request.user

if not point_type or point_type not in self.point_reward:
return Response({'error': 'Invalid point type'}, status=400)
Expand Down

0 comments on commit 13c8cca

Please sign in to comment.