From fecb2f3593bd048259994560e3025d556335c502 Mon Sep 17 00:00:00 2001 From: karthik-k-18 <200010024@iitdh.ac.in> Date: Sun, 11 Jun 2023 00:06:36 +0530 Subject: [PATCH] added field for offer acceptance --- .gitignore | 3 +++ CDC_Backend/APIs/companyViews.py | 2 +- CDC_Backend/APIs/constants.py | 2 +- CDC_Backend/APIs/models.py | 1 + CDC_Backend/APIs/studentUrls.py | 1 + CDC_Backend/APIs/studentViews.py | 8 +++++++- 6 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 445be84..64c7e13 100644 --- a/.gitignore +++ b/.gitignore @@ -140,3 +140,6 @@ dmypy.json .idea *.pyc dev.env + +#vscode settings +.vscode/ diff --git a/CDC_Backend/APIs/companyViews.py b/CDC_Backend/APIs/companyViews.py index 77d228e..590673e 100644 --- a/CDC_Backend/APIs/companyViews.py +++ b/CDC_Backend/APIs/companyViews.py @@ -194,7 +194,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 5696feb..526eb9e 100644 --- a/CDC_Backend/APIs/constants.py +++ b/CDC_Backend/APIs/constants.py @@ -66,7 +66,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 c68d846..50b4a6b 100644 --- a/CDC_Backend/APIs/studentViews.py +++ b/CDC_Backend/APIs/studentViews.py @@ -246,4 +246,10 @@ 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) \ No newline at end of file + status=status.HTTP_400_BAD_REQUEST) + +#view for sudentAcceptOffer +@api_view(['POST']) +@isAuthorized(allowed_users=[STUDENT]) +def studentAcceptOffer(request, id, email, user_type): + None \ No newline at end of file