diff --git a/CDC_Backend/APIs/studentViews.py b/CDC_Backend/APIs/studentViews.py index 50b4a6b..e02e0f1 100644 --- a/CDC_Backend/APIs/studentViews.py +++ b/CDC_Backend/APIs/studentViews.py @@ -252,4 +252,17 @@ def getContributorStats(request, id, email, user_type): @api_view(['POST']) @isAuthorized(allowed_users=[STUDENT]) def studentAcceptOffer(request, id, email, user_type): - None \ No newline at end of file + try: + company_id = request.data['id'] + student_id=request.data['profileInfo']['id'] + offer_status = request.data['offerStatus'] + placement_application=PlacementApplication.objects.get(placement=company_id,student=student_id) + placement_application.offer_accepted=offer_status + placement_application.save() + return Response({'action': "Accept Offer", 'message': "Updated Offer Status"}, + status=status.HTTP_200_OK) + except: + logger.warning("Accept Offer: " + str(sys.exc_info())) + + return Response({'action': "Accept Offer", 'message': "Something Went Wrong"}, + status=status.HTTP_400_BAD_REQUEST) \ No newline at end of file