diff --git a/.gitignore b/.gitignore index 3fba3fc..31682a1 100644 --- a/.gitignore +++ b/.gitignore @@ -141,3 +141,9 @@ dmypy.json *.pyc dev.env .vscode/settings.json + +#vscode settings +.vscode/ + +#vscode settings +.vscode/ diff --git a/CDC_Backend/APIs/companyViews.py b/CDC_Backend/APIs/companyViews.py index ec01f0a..60e144c 100644 --- a/CDC_Backend/APIs/companyViews.py +++ b/CDC_Backend/APIs/companyViews.py @@ -195,7 +195,7 @@ def addPlacement(request): '%d-%m-%Y').date() # Only Allowing Fourth Year for Placement - opening.allowed_batch = [2017, 2018, 2019, 2020, 2021] + opening.allowed_batch = [FOURTH_YEAR,] # Check if allowed_branch are valid if data[ALLOWED_BRANCH] is None: raise ValueError('Allowed Branch cannot be empty') diff --git a/CDC_Backend/APIs/constants.py b/CDC_Backend/APIs/constants.py index a25eba5..d2daf91 100644 --- a/CDC_Backend/APIs/constants.py +++ b/CDC_Backend/APIs/constants.py @@ -72,7 +72,7 @@ SUPER_ADMIN = 's_admin' COMPANY = 'company' TIER = 'tier' # To be Configured Properly -FOURTH_YEAR = '2019' +FOURTH_YEAR = '2020' MAX_OFFERS_PER_STUDENT = 2 MAX_RESUMES_PER_STUDENT = 3 EMAIL_VERIFICATION_TOKEN_TTL = 48 # in hours diff --git a/CDC_Backend/APIs/models.py b/CDC_Backend/APIs/models.py index 77d8c6a..8f9360b 100644 --- a/CDC_Backend/APIs/models.py +++ b/CDC_Backend/APIs/models.py @@ -221,6 +221,7 @@ class PlacementApplication(models.Model): resume = models.CharField(max_length=JNF_TEXT_MAX_CHARACTER_COUNT, blank=False, null=True, default=None) additional_info = models.JSONField(blank=True, null=True, default=None) selected = models.BooleanField(null=True, default=None, blank=True) + offer_accepted = models.BooleanField(null=True, default=None, blank=True) # True if offer accepted, False if rejected, None if not yet decided applied_at = models.DateTimeField(blank=False, default=None, null=True) updated_at = models.DateTimeField(blank=False, default=None, null=True) changed_by = models.ForeignKey(User, blank=False, on_delete=models.RESTRICT, default=None, null=True) diff --git a/CDC_Backend/APIs/studentUrls.py b/CDC_Backend/APIs/studentUrls.py index 8a1acce..f9dee52 100644 --- a/CDC_Backend/APIs/studentUrls.py +++ b/CDC_Backend/APIs/studentUrls.py @@ -11,4 +11,5 @@ urlpatterns = [ path("submitApplication/", studentViews.submitApplication, name="Submit Application"), path("deleteApplication/", studentViews.deleteApplication, name="Delete Application"), path("getContributorStats/", studentViews.getContributorStats, name="Get Contributor Stats"), + path("studentAcceptOffer/", studentViews.studentAcceptOffer, name="Student Accept Offer"), ] diff --git a/CDC_Backend/APIs/studentViews.py b/CDC_Backend/APIs/studentViews.py index b595dd8..62d36b4 100644 --- a/CDC_Backend/APIs/studentViews.py +++ b/CDC_Backend/APIs/studentViews.py @@ -273,4 +273,23 @@ def getContributorStats(request, id, email, user_type): logger.warning("Get Contributor Stats: " + str(sys.exc_info())) return Response({'action': "Get Contributor Stats", 'message': "Something Went Wrong"}, + status=status.HTTP_400_BAD_REQUEST) + +#view for sudentAcceptOffer +@api_view(['POST']) +@isAuthorized(allowed_users=[STUDENT]) +def studentAcceptOffer(request, id, email, user_type): + 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