Merge branch 'main' into Updated_appilication

This commit is contained in:
karthikmurakonda 2022-07-23 15:09:01 +05:30
commit 0488e3e334
9 changed files with 1009 additions and 537 deletions

View File

@ -1,4 +1,5 @@
from django.contrib import admin
from simple_history.admin import SimpleHistoryAdmin
from django.contrib.admin.templatetags.admin_urls import admin_urlname
from django.shortcuts import resolve_url
from django.utils.html import format_html
@ -6,8 +7,8 @@ from django.utils.safestring import SafeText
from .models import *
admin.site.register(User)
admin.site.register(Admin)
admin.site.register(User, SimpleHistoryAdmin)
admin.site.register(Admin, SimpleHistoryAdmin)
admin.site.site_header = "CDC Recruitment Portal"
@ -18,7 +19,7 @@ def model_admin_url(obj, name=None) -> str:
@admin.register(Student)
class Student(admin.ModelAdmin):
class Student(SimpleHistoryAdmin):
list_display = ("roll_no", "name", "batch", "branch", "phone_number", 'can_apply')
search_fields = ("roll_no", "name", "phone_number")
ordering = ("roll_no", "name", "batch", "branch", "phone_number")
@ -37,7 +38,7 @@ class Student(admin.ModelAdmin):
@admin.register(Placement)
class Placement(admin.ModelAdmin):
class Placement(SimpleHistoryAdmin):
list_display = (COMPANY_NAME, CONTACT_PERSON_NAME, PHONE_NUMBER, 'tier', 'compensation_CTC')
search_fields = (COMPANY_NAME, CONTACT_PERSON_NAME)
ordering = (COMPANY_NAME, CONTACT_PERSON_NAME, 'tier', 'compensation_CTC')
@ -45,7 +46,7 @@ class Placement(admin.ModelAdmin):
@admin.register(PlacementApplication)
class PlacementApplication(admin.ModelAdmin):
class PlacementApplication(SimpleHistoryAdmin):
list_display = ('id', 'Placement', 'Student', 'selected')
search_fields = ('id',)
ordering = ('id',)
@ -59,7 +60,7 @@ class PlacementApplication(admin.ModelAdmin):
@admin.register(PrePlacementOffer)
class PrePlacementOffer(admin.ModelAdmin):
class PrePlacementOffer(SimpleHistoryAdmin):
list_display = ('company', 'Student', 'accepted')
search_fields = ('company',)
ordering = ('company',)

View File

@ -8,7 +8,8 @@ urlpatterns = [
path('updateDeadline/', adminViews.updateDeadline, name="Update Deadline"),
path('updateOfferAccepted/', adminViews.updateOfferAccepted, name="Update Offer Accepted"),
path('updateEmailVerified', adminViews.updateEmailVerified, name="Update Email Verified"),
path('updateAdditionalInfo/', adminViews.updateAdditionalInfo, name="Update Additional Info"),
path('deleteAdditionalInfo/', adminViews.deleteAdditionalInfo, name="Delete Additional Info"),
path('addAdditionalInfo/', adminViews.addAdditionalInfo, name="Add Additional Info"),
path('getApplications/', adminViews.getApplications, name="Get Applications"),
path("submitApplication/", adminViews.submitApplication, name="Submit Application"),
path('generateCSV/', adminViews.generateCSV, name="Generate CSV"),

View File

@ -39,6 +39,7 @@ def markStatus(request, id, email, user_type):
sendEmail(email, subject, data, STUDENT_APPLICATION_STATUS_SELECTED_TEMPLATE)
else:
sendEmail(email, subject, data, STUDENT_APPLICATION_STATUS_NOT_SELECTED_TEMPLATE)
application.chaged_by = get_object_or_404(User, id=id)
application.save()
else:
raise ValueError("Student - " + i[STUDENT_ID] + " didn't apply for this opening")
@ -89,6 +90,7 @@ def updateDeadline(request, id, email, user_type):
opening = get_object_or_404(Placement, pk=data[OPENING_ID])
# Updating deadline date with correct format in datetime field
opening.deadline_datetime = datetime.datetime.strptime(data[DEADLINE_DATETIME], '%Y-%m-%d %H:%M:%S %z')
opening.changed_by = get_object_or_404(User, id=id)
opening.save()
return Response({'action': "Update Deadline", 'message': "Deadline Updated"},
status=status.HTTP_200_OK)
@ -111,6 +113,7 @@ def updateOfferAccepted(request, id, email, user_type):
opening = get_object_or_404(Placement, pk=data[OPENING_ID])
opening.offer_accepted = True if data[OFFER_ACCEPTED] == True else False
print(opening.offer_accepted)
opening.changed_by = get_object_or_404(User, id=id)
opening.save()
return Response({'action': "Update Offer Accepted", 'message': "Offer Accepted Updated"},
status=status.HTTP_200_OK)
@ -131,6 +134,7 @@ def updateEmailVerified(request, id, email, user_type):
data = request.data
opening = get_object_or_404(Placement, pk=data[OPENING_ID])
opening.email_verified = True if data[EMAIL_VERIFIED] == "true" else False
opening.changed_by = get_object_or_404(User, id=id)
opening.save()
return Response({'action': "Update Email Verified", 'message': "Email Verified Updated"},
status=status.HTTP_200_OK)
@ -145,32 +149,58 @@ def updateEmailVerified(request, id, email, user_type):
@api_view(['POST'])
@isAuthorized([ADMIN])
@precheck([OPENING_ID, ADDITIONAL_INFO])
def updateAdditionalInfo(request, id, email, user_type):
@precheck([OPENING_ID, FIELD])
def deleteAdditionalInfo(request, id, email, user_type):
try:
data = request.data
opening = get_object_or_404(Placement, pk=data[OPENING_ID])
if data[ADDITIONAL_INFO] == "":
opening.additional_info = []
elif isinstance(data[ADDITIONAL_INFO], list):
opening.additional_info = data[ADDITIONAL_INFO]
else:
raise ValueError("Additional Info must be a list")
if data[FIELD] in opening.additional_info:
opening.additional_info.remove(data[FIELD])
opening.changed_by = get_object_or_404(User, id=id)
opening.save()
return Response({'action': "Update Additional Info", 'message': "Additional Info Updated"},
return Response({'action': "Delete Additional Info", 'message': "Additional Info Deleted"},
status=status.HTTP_200_OK)
else:
raise ValueError("Additional Info Not Found")
except Http404:
return Response({'action': "Update Additional Info", 'message': 'Opening Not Found'},
return Response({'action': "Delete Additional Info", 'message': 'Opening Not Found'},
status=status.HTTP_404_NOT_FOUND)
except ValueError:
return Response({'action': "Update Additional Info", 'message': "Additional Info must be a list"},
return Response({'action': "Delete Additional Info", 'message': "Additional Info not found"},
status=status.HTTP_404_NOT_FOUND)
except Exception as e:
logger.warning("Delete Additional Info: " + str(e))
return Response({'action': "Delete Additional Info", 'message': "Something went wrong"},
status=status.HTTP_400_BAD_REQUEST)
@api_view(['POST'])
@isAuthorized([ADMIN])
@precheck([OPENING_ID, FIELD])
def addAdditionalInfo(request, id, email, user_type):
try:
data = request.data
opening = get_object_or_404(Placement, pk=data[OPENING_ID])
if data[FIELD] not in opening.additional_info:
opening.additional_info.append(data[FIELD])
opening.save()
return Response({'action': "Add Additional Info", 'message': "Additional Info Added"},
status=status.HTTP_200_OK)
else:
raise ValueError("Additional Info Found")
except Http404:
return Response({'action': "Add Additional Info", 'message': 'Opening Not Found'},
status=status.HTTP_404_NOT_FOUND)
except ValueError:
return Response({'action': "Add Additional Info", 'message': "Additional Info already found"},
status=status.HTTP_400_BAD_REQUEST)
except Exception as e:
logger.warning("Update Additional Info: " + str(e))
return Response({'action': "Update Additional Info", 'message': "Something went wrong"},
logger.warning("Add Additional Info: " + str(e))
return Response({'action': "Add Additional Info", 'message': "Something went wrong"},
status=status.HTTP_400_BAD_REQUEST)
@api_view(['GET'])
@isAuthorized([ADMIN])
@precheck([OPENING_ID])
@ -223,6 +253,7 @@ def submitApplication(request, id, email, user_type):
"application_type": "Placement",
"additional_info": dict(json.loads(application.additional_info)),
}
application.changed_by = get_object_or_404(User, id=id)
application.save()
sendEmail(user.email, STUDENT_APPLICATION_SUBMITTED_TEMPLATE_SUBJECT, data, STUDENT_APPLICATION_SUBMITTED_TEMPLATE)
return Response({'action': "Add Student Application", 'message': "Application added"},
@ -249,6 +280,7 @@ def submitApplication(request, id, email, user_type):
"application_type": "Placement",
"additional_info": dict(json.loads(application.additional_info)),
}
application.changed_by = get_object_or_404(User, id=id)
application.save()
sendEmail(user.email, STUDENT_APPLICATION_UPDATED_TEMPLATE_SUBJECT, data, STUDENT_APPLICATION_UPDATED_TEMPLATE)
return Response({'action': "Add Student Application", 'message': "Application updated"},
@ -340,6 +372,7 @@ def addPPO(request, id, email, user_type):
PPO.tier = data[TIER]
if COMPENSATION_DETAILS in data:
PPO.compensation_details = data[COMPENSATION_DETAILS]
PPO.changed_by = get_object_or_404(User, id=id)
PPO.save()
return Response({'action': "Add PPO", 'message': "PPO added"},
status=status.HTTP_200_OK)

View File

@ -70,6 +70,7 @@ RESUME_FILE_NAME = 'resume_file_name'
APPLICATION_ID = "application_id"
OPENING_ID = "opening_id"
ADDITIONAL_INFO = "additional_info"
FIELD = "field"
STATUS_ACCEPTING_APPLICATIONS = "Accepting Applications"

View File

@ -1,6 +1,7 @@
from django.contrib.postgres.fields import ArrayField
from django.db import models
from django.utils import timezone
from simple_history.models import HistoricalRecords
from .constants import *
@ -13,6 +14,7 @@ class User(models.Model):
id = models.CharField(blank=False, max_length=25, index=True, unique=True)
user_type = ArrayField(models.CharField(blank=False, max_length=10), size=4, default=list, blank=False)
last_login_time = models.DateTimeField(default=timezone.now)
history = HistoricalRecords()
class Meta:
verbose_name_plural = "User"
@ -30,14 +32,41 @@ class Student(models.Model):
default=list, blank=True)
cpi = models.DecimalField(decimal_places=2, max_digits=4)
can_apply = models.BooleanField(default=True, verbose_name='Registered')
changed_by = models.ForeignKey(User, blank=True, on_delete=models.RESTRICT, default=None, null=True)
history = HistoricalRecords(user_model=User)
def __str__(self):
return str(self.roll_no)
@property
def _history_user(self):
return self.changed_by
@_history_user.setter
def _history_user(self, value):
if isinstance(value, User):
self.changed_by = value
else:
self.changed_by = None
class Admin(models.Model):
id = models.CharField(blank=False, max_length=15, primary_key=True)
name = models.CharField(blank=False, max_length=JNF_TEXT_MAX_CHARACTER_COUNT)
changed_by = models.ForeignKey(User, blank=True, on_delete=models.RESTRICT, default=None, null=True)
history = HistoricalRecords(user_model=User)
@property
def _history_user(self):
return self.changed_by
@_history_user.setter
def _history_user(self, value):
if isinstance(value, User):
self.changed_by = value
else:
self.changed_by = None
def two_day_after_today():
@ -114,7 +143,8 @@ class Placement(models.Model):
deadline_datetime = models.DateTimeField(blank=False, verbose_name="Deadline Date", default=two_day_after_today)
created_at = models.DateTimeField(blank=False, default=None, null=True)
updated_at = models.DateTimeField(blank=False, default=None, null=True)
changed_by = models.ForeignKey(User, on_delete=models.CASCADE, blank=True, null=True)
history = HistoricalRecords(user_model=User)
def format(self):
if self.company_name is not None:
self.company_name = self.company_name.strip()[:JNF_SMALLTEXT_MAX_CHARACTER_COUNT]
@ -158,6 +188,17 @@ class Placement(models.Model):
if self.additional_info is not None:
self.additional_info = [info.strip()[:JNF_TEXTMEDIUM_MAX_CHARACTER_COUNT] for info in list(self.additional_info)]
@property
def _history_user(self):
return self.changed_by
@_history_user.setter
def _history_user(self, value):
if isinstance(value, User):
self.changed_by = value
else:
self.changed_by = None
def save(self, *args, **kwargs):
''' On save, add timestamps '''
if not self.created_at:
@ -179,6 +220,8 @@ class PlacementApplication(models.Model):
selected = models.BooleanField(null=True, default=None, blank=True)
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)
history = HistoricalRecords(user_model=User)
def save(self, *args, **kwargs):
''' On save, add timestamps '''
@ -188,6 +231,17 @@ class PlacementApplication(models.Model):
return super(PlacementApplication, self).save(*args, **kwargs)
@property
def _history_user(self):
return self.changed_by
@_history_user.setter
def _history_user(self, value):
if isinstance(value, User):
self.changed_by = value
else:
self.changed_by = None
class Meta:
verbose_name_plural = "Placement Applications"
unique_together = ('placement_id', 'student_id')
@ -206,3 +260,16 @@ class PrePlacementOffer(models.Model):
tier = models.CharField(blank=False, choices=TIERS, max_length=10)
designation = models.CharField(blank=False, max_length=25, default=None, null=True)
accepted = models.BooleanField(default=None, null=True)
changed_by = models.ForeignKey(User, blank=False, on_delete=models.RESTRICT, default=None, null=True)
history = HistoricalRecords(user_model=User)
@property
def _history_user(self):
return self.changed_by
@_history_user.setter
def _history_user(self, value):
if isinstance(value, User):
self.changed_by = value
else:
self.changed_by = None

View File

@ -44,7 +44,7 @@ def addResume(request, id, email, user_type):
destination_path = STORAGE_DESTINATION_RESUMES + str(student.roll_no) + "/"
file_name = saveFile(file, destination_path)
student.resumes.append(file_name)
student.changed_by = get_object_or_404(User, id=id)
student.save()
return Response({'action': "Upload Resume", 'message': "Resume Added"},
status=status.HTTP_200_OK)
@ -102,8 +102,9 @@ def deleteResume(request, id, email, user_type):
destination_path = STORAGE_DESTINATION_RESUMES + id + "/" + str(file_name)
if path.exists(destination_path):
remove(destination_path)
# remove(destination_path)
student.resumes.remove(file_name)
student.changed_by = get_object_or_404(User, id=id)
student.save()
return Response({'action': "Delete Resume", 'message': "Resume Deleted"},
status=status.HTTP_200_OK)
@ -177,7 +178,7 @@ def submitApplication(request, id, email, user_type):
}
subject = STUDENT_APPLICATION_SUBMITTED_TEMPLATE_SUBJECT.format(company_name=opening.company_name)
sendEmail(email, subject, data, STUDENT_APPLICATION_SUBMITTED_TEMPLATE)
application.changed_by = get_object_or_404(User, id=id)
application.save()
return Response({'action': "Submit Application", 'message': "Application Submitted"},
status=status.HTTP_200_OK)

View File

@ -29,7 +29,7 @@ SECRET_KEY = 'e_i2g3z!y4+p3dwm%k9k=zmsot@aya-0$mmetgxz4mp#8_oy#*'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['cdc-iitdh.herokuapp.com/', 'localhost', '192.168.29.199']
ALLOWED_HOSTS = ['cdc-iitdh.herokuapp.com/', 'localhost', '192.168.29.199', '127.0.0.1']
# Application definition
@ -44,7 +44,8 @@ INSTALLED_APPS = [
'rest_framework',
'corsheaders',
'django_db_logger',
'background_task'
'background_task',
'simple_history',
]
MIDDLEWARE = [
@ -57,7 +58,7 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'simple_history.middleware.HistoryRequestMiddleware',
]
ROOT_URLCONF = 'CDC_Backend.urls'

View File

@ -15,6 +15,11 @@
4. [**api/admin/updateOfferAccepted**](#apiadminupdateofferaccepted)
5. [**api/admin/updateEmailVerified**](#apiadminupdateemailverified)
6. [**api/admin/updateAdditionalInfo**](#apiadminupdateadditionalinfo)
7. [**api/admin/getApplications**](#apiadmingetApplications)
8. [**api/admin/submitApplication**](#apiadminsubmitApplication)
9. [**api/admin/generateCSV**](#apiadmingeneratecsv)
10. [**api/admin/addPPO**](#apiadminaddppo)
11. [**api/admin/getStudentApplication**](#apiadmingetstudentapplication)
4. [**Company APIs**](#company-portal-apis)
1. [**api/company/addPlacement/**](#apicompanyaddplacement)
5. [**Common Errors**](#common-errors)
@ -47,9 +52,7 @@ Response is a Json with these fields
{
"action": "Login",
"message": "Verified",
"user_type": [
"student"
]
"user_type": ["student"]
}
```
@ -131,7 +134,7 @@ Response is a Json with these fields
The possible responses for this api request are as follows
| Status Codes | Possible Messages |
| --------------- | ------------------------ |
| --------------- | ---------------------- |
| 200 OK | `Details Found` |
| 400 BAD_REQUEST | `Something Went Wrong` |
@ -240,20 +243,11 @@ Response is a Json with these fields
"is_selection_procedure_details_pdf": true,
"tier": "4",
"tentative_date_of_joining": "2022-01-15",
"allowed_batch": [
"2018",
"2019"
],
"allowed_branch": [
"CSE",
"EE"
],
"allowed_batch": ["2018", "2019"],
"allowed_branch": ["CSE", "EE"],
"tentative_no_of_offers": 5,
"other_requirements": "above 8 cpi",
"additional_info": [
"School",
"Home Town"
],
"additional_info": ["School", "Home Town"],
"deadline_date": "2021-12-04",
"created_at": "2021-12-02T20:12:21+05:30"
}
@ -334,20 +328,11 @@ Response is a Json with these fields
"is_selection_procedure_details_pdf": true,
"tier": "4",
"tentative_date_of_joining": "2022-01-15",
"allowed_batch": [
"2018",
"2019"
],
"allowed_branch": [
"CSE",
"EE"
],
"allowed_batch": ["2018", "2019"],
"allowed_branch": ["CSE", "EE"],
"tentative_no_of_offers": 5,
"other_requirements": "above 8 cpi",
"additional_info": [
"School",
"Home Town"
],
"additional_info": ["School", "Home Town"],
"deadline_date": "2021-12-04",
"created_at": "2021-12-02T20:12:21+05:30"
},
@ -370,7 +355,7 @@ Response is a Json with these fields
The possible responses for this api request are as follows
| Status Codes | Possible Messages |
| --------------- | ------------------------ |
| --------------- | ---------------------- |
| 200 OK | `Data Found` |
| 404 Not Found | `Student Not Found` |
| 400 BAD_REQUEST | `Something Went Wrong` |
@ -553,12 +538,12 @@ Request_Body:
"opening_id": "Q54IRZZMC3RP8F6",
"student_list": [
{
"student_id":"190010036",
"student_selected":"true"
"student_id": "190010036",
"student_selected": "true"
},
{
"student_id":"190050022",
"student_selected":"false"
"student_id": "190050022",
"student_selected": "false"
}
]
}
@ -586,7 +571,7 @@ Response is a Json with these fields
The possible responses for this api request are as follows
| Status Codes | Possible Messages |
| --------------- | ------------------------ |
| --------------- | ---------------------- |
| 200 OK | `Marked Status` |
| 400 BAD_REQUEST | `Something Went Wrong` |
@ -619,6 +604,94 @@ Response is a Json with these fields
{
"action": "Get Dashboard - Admin",
"message": "Data Found",
"new": [
{
"id": "Z54IRZZMB3RP9TR",
"company_details_pdf_links": [
{
"link": "https://storage.googleapis.com/cdc-backend-attachments/company_attachments/Q54IRZZMC3RP8F6%2FI5U4RDTV0OP0EM0_2019+Student+Details+-+Total%28State+Sort%29+-+Copy.pdf",
"name": "I5U4RDTV0OP0EM0_2019 Student Details - Total(State Sort) - Copy.pdf"
},
{
"link": "https://storage.googleapis.com/cdc-backend-attachments/company_attachments/Q54IRZZMC3RP8F6%2FW04JWWNNMIBX0JX_2019+Student+Details+-+Total%28State+Sort%29.pdf",
"name": "W04JWWNNMIBX0JX_2019 Student Details - Total(State Sort).pdf"
},
{
"link": "https://storage.googleapis.com/cdc-backend-attachments/company_attachments/Q54IRZZMC3RP8F6%2FT1BXP98WBT9BHOR_AP0313017732021LL-Driving+Licence+-+Copy.pdf",
"name": "T1BXP98WBT9BHOR_AP0313017732021LL-Driving Licence - Copy.pdf"
}
],
"description_pdf_links": [
{
"link": "https://storage.googleapis.com/cdc-backend-attachments/company_attachments/Q54IRZZMC3RP8F6%2FC78TE2Z67BPZ41O_CSE-V-SEM.pdf",
"name": "C78TE2Z67BPZ41O_CSE-V-SEM.pdf"
}
],
"compensation_pdf_links": [
{
"link": "https://storage.googleapis.com/cdc-backend-attachments/company_attachments/Q54IRZZMC3RP8F6%2F8D5OFQ46H43DD3S_module5And6Attendance.pdf",
"name": "8D5OFQ46H43DD3S_module5And6Attendance.pdf"
},
{
"link": "https://storage.googleapis.com/cdc-backend-attachments/company_attachments/Q54IRZZMC3RP8F6%2FG8OU2PE919PFKSR_Print+Application11.pdf",
"name": "G8OU2PE919PFKSR_Print Application11.pdf"
}
],
"selection_procedure_details_pdf_links": [
{
"link": "https://storage.googleapis.com/cdc-backend-attachments/company_attachments/Q54IRZZMC3RP8F6%2FDZTQQ6YBGBQ47PY_screencapture-onlinesbi-sbi-sbicollect-fsssuccessresponseredirect-htm-2021-07-19-18_",
"name": "DZTQQ6YBGBQ47PY_screencapture-onlinesbi-sbi-sbicollect-fsssuccessresponseredirect-htm-2021-07-19-18_"
},
{
"link": "https://storage.googleapis.com/cdc-backend-attachments/company_attachments/Q54IRZZMC3RP8F6%2FN490PUXJEEN4JZ9_screencapture-onlinesbi-sbi-sbicollect-payment-suvidhapayment-htm-2021-07-19-23_12_3",
"name": "N490PUXJEEN4JZ9_screencapture-onlinesbi-sbi-sbicollect-payment-suvidhapayment-htm-2021-07-19-23_12_3"
}
],
"company_name": "Cred",
"address": "Cred India Pvt. Ltd.5, Awagarh House, MG Road(next to Bachoomal collections)Agra (UP), - 282002India",
"company_type": "Private Sector",
"nature_of_business": "Technology",
"website": "www.cred.com",
"company_details": "This s a very nice company",
"is_company_details_pdf": true,
"contact_person_name": "John",
"phone_number": 9390291922,
"email": "@gmail.com",
"city": "Mumbai",
"state": "Maharashtra",
"country": "India",
"pin_code": 530013,
"city_type": "Domestic",
"designation": "Software Developer",
"description": "very nice job",
"is_description_pdf": true,
"compensation_CTC": 1200000,
"compensation_gross": 1100000,
"compensation_take_home": 1000000,
"compensation_bonus": 10000,
"compensation_details": "very good compensation",
"is_compensation_details_pdf": true,
"bond_details": "nil",
"selection_procedure_rounds": [
"Resume Shortlisting",
"Technical Interview",
"HR Interview"
],
"selection_procedure_details": "All rounds are complusory",
"is_selection_procedure_details_pdf": true,
"tier": "4",
"tentative_date_of_joining": "2022-01-15",
"allowed_batch": ["2018", "2019"],
"allowed_branch": ["CSE", "EE"],
"tentative_no_of_offers": 5,
"other_requirements": "above 8 cpi",
"additional_info": ["School", "Home Town"],
"email_verified": false,
"offer_accepted": null,
"deadline_date": "2021-12-04",
"created_at": "2021-12-02T20:12:21+05:30"
}
],
"ongoing": [
{
"id": "Q54IRZZMC3RP8F6",
@ -696,27 +769,105 @@ Response is a Json with these fields
"is_selection_procedure_details_pdf": true,
"tier": "4",
"tentative_date_of_joining": "2022-01-15",
"allowed_batch": [
"2018",
"2019"
],
"allowed_branch": [
"CSE",
"EE"
],
"allowed_batch": ["2018", "2019"],
"allowed_branch": ["CSE", "EE"],
"tentative_no_of_offers": 5,
"other_requirements": "above 8 cpi",
"additional_info": [
"School",
"Home Town"
],
"additional_info": ["School", "Home Town"],
"email_verified": false,
"offer_accepted": null,
"deadline_date": "2021-12-04",
"created_at": "2021-12-02T20:12:21+05:30"
}
],
"previous": []
"previous": [
{
"id": "Q74IRZZMC3RP8F6",
"company_details_pdf_links": [
{
"link": "https://storage.googleapis.com/cdc-backend-attachments/company_attachments/Q54IRZZMC3RP8F6%2FI5U4RDTV0OP0EM0_2019+Student+Details+-+Total%28State+Sort%29+-+Copy.pdf",
"name": "I5U4RDTV0OP0EM0_2019 Student Details - Total(State Sort) - Copy.pdf"
},
{
"link": "https://storage.googleapis.com/cdc-backend-attachments/company_attachments/Q54IRZZMC3RP8F6%2FW04JWWNNMIBX0JX_2019+Student+Details+-+Total%28State+Sort%29.pdf",
"name": "W04JWWNNMIBX0JX_2019 Student Details - Total(State Sort).pdf"
},
{
"link": "https://storage.googleapis.com/cdc-backend-attachments/company_attachments/Q54IRZZMC3RP8F6%2FT1BXP98WBT9BHOR_AP0313017732021LL-Driving+Licence+-+Copy.pdf",
"name": "T1BXP98WBT9BHOR_AP0313017732021LL-Driving Licence - Copy.pdf"
}
],
"description_pdf_links": [
{
"link": "https://storage.googleapis.com/cdc-backend-attachments/company_attachments/Q54IRZZMC3RP8F6%2FC78TE2Z67BPZ41O_CSE-V-SEM.pdf",
"name": "C78TE2Z67BPZ41O_CSE-V-SEM.pdf"
}
],
"compensation_pdf_links": [
{
"link": "https://storage.googleapis.com/cdc-backend-attachments/company_attachments/Q54IRZZMC3RP8F6%2F8D5OFQ46H43DD3S_module5And6Attendance.pdf",
"name": "8D5OFQ46H43DD3S_module5And6Attendance.pdf"
},
{
"link": "https://storage.googleapis.com/cdc-backend-attachments/company_attachments/Q54IRZZMC3RP8F6%2FG8OU2PE919PFKSR_Print+Application11.pdf",
"name": "G8OU2PE919PFKSR_Print Application11.pdf"
}
],
"selection_procedure_details_pdf_links": [
{
"link": "https://storage.googleapis.com/cdc-backend-attachments/company_attachments/Q54IRZZMC3RP8F6%2FDZTQQ6YBGBQ47PY_screencapture-onlinesbi-sbi-sbicollect-fsssuccessresponseredirect-htm-2021-07-19-18_",
"name": "DZTQQ6YBGBQ47PY_screencapture-onlinesbi-sbi-sbicollect-fsssuccessresponseredirect-htm-2021-07-19-18_"
},
{
"link": "https://storage.googleapis.com/cdc-backend-attachments/company_attachments/Q54IRZZMC3RP8F6%2FN490PUXJEEN4JZ9_screencapture-onlinesbi-sbi-sbicollect-payment-suvidhapayment-htm-2021-07-19-23_12_3",
"name": "N490PUXJEEN4JZ9_screencapture-onlinesbi-sbi-sbicollect-payment-suvidhapayment-htm-2021-07-19-23_12_3"
}
],
"company_name": "Make My Trip",
"address": "MakeMyTrip India Pvt. Ltd.5, Awagarh House, MG Road(next to Bachoomal collections)Agra (UP), - 282002India",
"company_type": "Private Sector",
"nature_of_business": "Technology",
"website": "www.makemytrip.com",
"company_details": "This s a very nice company",
"is_company_details_pdf": true,
"contact_person_name": "Gowtham",
"phone_number": 9390291911,
"email": "saisurya3127@gmail.com",
"city": "Mumbai",
"state": "Maharashtra",
"country": "India",
"pin_code": 530013,
"city_type": "Domestic",
"designation": "Software Developer",
"description": "very nice job",
"is_description_pdf": true,
"compensation_CTC": 1200000,
"compensation_gross": 1100000,
"compensation_take_home": 1000000,
"compensation_bonus": 10000,
"compensation_details": "very good compensation",
"is_compensation_details_pdf": true,
"bond_details": "nil",
"selection_procedure_rounds": [
"Resume Shortlisting",
"Technical Interview",
"HR Interview"
],
"selection_procedure_details": "All rounds are complusory",
"is_selection_procedure_details_pdf": true,
"tier": "4",
"tentative_date_of_joining": "2022-01-15",
"allowed_batch": ["2018", "2019"],
"allowed_branch": ["CSE", "EE"],
"tentative_no_of_offers": 5,
"other_requirements": "above 8 cpi",
"additional_info": ["School", "Home Town"],
"email_verified": false,
"offer_accepted": null,
"deadline_date": "2021-12-04",
"created_at": "2021-12-02T20:12:21+05:30"
}
]
}
```
@ -724,13 +875,14 @@ Response is a Json with these fields
- message: Tells us what happened with our Request.
- ongoing: Gives us the list of placements that are accepting applications.
- previous: Gives us the list of placements that stopped accepting applications.
- new : Gives us the list of placements that is not yet accepeted by CDC.
### Status Codes
The possible responses for this api request are as follows
| Status Codes | Possible Messages |
| --------------- | ------------------------ |
| --------------- | ---------------------- |
| 200 OK | `Data Found` |
| 400 BAD_REQUEST | `Something Went Wrong` |
@ -776,7 +928,7 @@ Response is a Json with these fields
The possible responses for this api request are as follows
| Status Codes | Possible Messages |
| --------------- | ------------------------ |
| --------------- | ---------------------- |
| 200 OK | `Deadline Updated` |
| 400 BAD_REQUEST | `Something Went Wrong` |
@ -822,7 +974,7 @@ Response is a Json with these fields
The possible responses for this api request are as follows
| Status Codes | Possible Messages |
| --------------- | ------------------------ |
| --------------- | ----------------------- |
| 200 OK | `Update Offer Accepted` |
| 400 BAD_REQUEST | `Something Went Wrong` |
@ -888,11 +1040,7 @@ Request_Body:
```json
{
"opening_id": "Q54IRZZMC3RP8F6",
"additional_info": [
"School",
"Place of Living",
"Research Interests"
]
"additional_info": ["School", "Place of Living", "Research Interests"]
}
```
@ -918,7 +1066,7 @@ Response is a Json with these fields
The possible responses for this api request are as follows
| Status Codes | Possible Messages |
| --------------- | ------------------------ |
| --------------- | ------------------------- |
| 200 OK | `Additional Info Updated` |
| 400 BAD_REQUEST | `Something Went Wrong` |
@ -926,6 +1074,294 @@ You may see some different errors which can be seen [here](#common-errors)
---
<!-- new branch -->
## `api/admin/getApplications`
This api is used to fetch all the applications applied by students for all placements
### How to Use?
Send a `POST` request to `api/admin/getApplications`<br>
Request_Body:
```json
{
"opening_id": "Q54IRZZMC3RP8F6"
}
```
> Headers <br>
> Authorization: "Bearer {tokenID}"
### Response
Response is a Json with these fields
```json
{
"action": "Get Applications",
"message": "Data Found",
"applications": [
{
"id": "200010021",
"student_details": {
"id": "200010021",
"resume_list": [
{
"link": "http://localhost/storage/Resumes/200010021/resume_link",
"name": "resume_link"
}
],
"offers": [
{
"designation": "sde",
"company_name": "JP Morgan",
"application_id": "200010021",
"placement_offer_type": "Normal"
}
],
"roll_no": 200010021,
"name": "John",
"batch": "2020",
"branch": "CSE",
"phone_number": 8105699450,
"cpi": "9.00",
"can_apply": true
},
"resume_link": {
"link": "http://localhost/storage/Resumes/200010021/resume_links",
"name": "resume_links"
},
"additional_info": null,
"selected": true,
"applied_at": "2022-05-30T19:15:33+05:30",
"updated_at": "2022-05-30T19:16:31.662929+05:30",
"student": "200010021"
}
]
}
```
- action: Tells us about the message creator<Br>
- message: Tells us what happened with our Request.
### Status Codes
The possible responses for this api request are as follows
| Status Codes | Possible Messages |
| --------------- | ---------------------- |
| 200 OK | `Data Found` |
| 400 BAD_REQUEST | `Something Went Wrong` |
You may see some different errors which can be seen [here](#common-errors)
---
## `api/admin/submitApplication`
This api is used to submit a students application
Request_Body:
```json
{
"applications_id": "F28IRGGMC3RP8Y8",
"student_id": "200010022",
"opening_id": "Q54IRZZMC3RP8F6",
"additional_info": {
"School": "Lions International",
"City": "Banglore"
},
"resume_file_name": "8KIOT3PW1JIS718_CSE-V-SEM.pdf"
}
```
> Headers <br>
> Authorization: "Bearer {tokenID}"
### Response
Response is a Json with these fields
```json
{
"action": "Add Student Application",
"message": "Application Added"
}
```
### Status Codes
The possible responses for this api request are as follows
| Status Codes | Possible Messages |
| --------------- | ---------------------- |
| 200 OK | `Application Added` |
| 400 BAD_REQUEST | `Something Went Wrong` |
You may see some different errors which can be seen [here](#common-errors)
---
## `api/admin/generateCSV`
This api is used to generate a CSV file that contains sequential details of all the applications
Request_Body:
```json
{
"opening_id": "Q54IRZZMC3RP8F6"
}
```
> Headers <br>
> Authorization: "Bearer {tokenID}"
### Response
Response is a Json with these fields
```json
{
"action": "Create CSV",
"message": "CSV Created",
"file": "csv_file_link"
}
```
### Status Codes
The possible responses for this api request are as follows
| Status Codes | Possible Messages |
| --------------- | ---------------------- |
| 200 OK | `CSV created` |
| 400 BAD_REQUEST | `Something Went Wrong` |
You may see some different errors which can be seen [here](#common-errors)
---
## `api/admin/addPPO`
This api is used to add a PPO for a student in the corresponding company
Request_Body:
```json
{
"company_name": "Geeks for Geeks",
"compensation_gross": "1000000",
"offer_accepted": "true",
"student_id": "200010022",
"designation": "Technical Content Writer",
"tier": "4"
}
```
### Response
Response is a Json with these fields
```json
{
"action": "Add PPO",
"message": "PPO Added"
}
```
### Status Codes
The possible responses for this api request are as follows
| Status Codes | Possible Messages |
| --------------- | ---------------------- |
| 200 OK | `PPO Added` |
| 400 BAD_REQUEST | `Something Went Wrong` |
You may see some different errors which can be seen [here](#common-errors)
---
## `api/admin/getStudentApplication`
This api is used to fetch the application details of the required student
Request_Body:
```json
{
"student_id": "200010022",
"opening_id": "Q54IRZZMC3RP8F6"
}
```
> Headers <br>
> Authorization: "Bearer {tokenID}"
### Response
Response is a Json with these fields when the application is found.
```json
{
"action": "Get Student Application",
"application_found": "true",
"application_info": {
"id": "F28IRGGMC3RP8Y8",
"additional_info": {
"12th grade": "9.1",
"current GPA": "9.6"
},
"resume": "resume_link"
},
"student_details": {
"name": "John",
"batch": "2020",
"branch": "MMAE",
"resume_list": {
"link": "http://localhost/storage/Resumes/200010021/resume_links",
"name": "resume_link"
}
}
}
```
Response is a Json with these fields when the applciation is not found.
```json
{
"action": "Get Student Application",
"application_found": "false",
"student_details": {
"name": "John",
"batch": "2020",
"branch": "MMAE",
"resume_list": {
"link": "http://localhost/storage/Resumes/200010021/resume_links",
"name": "resume_link"
}
}
}
```
### Status Codes
The possible responses for this api request are as follows
| Status Codes | Possible Messages |
| --------------- | ----------------------- |
| 200 OK | `` |
| 400 BAD_REQUEST | `Something Went Wrong` |
| 404 NOT_FOUND | `Application not found` |
You may see some different errors which can be seen [here](#common-errors)
---
# Company Portal APIs
## `api/company/addPlacement/`
@ -940,113 +1376,45 @@ Request_Body:
```json
{
"company_name": [
"Make My Trip"
],
"company_name": ["Make My Trip"],
"address": [
"MakeMyTrip India Pvt. Ltd.\n5, Awagarh House, MG Road\n(next to Bachoomal collections)\nAgra (UP), - 282002\nIndia"
],
"company_type": [
"Private Sector"
],
"nature_of_business": [
"Technology"
],
"website": [
"www.makemytrip.com"
],
"company_details": [
"This s a very nice company"
],
"is_company_details_pdf": [
"true"
],
"contact_person_name": [
"Gowtham"
],
"phone_number": [
"9390291911"
],
"email": [
"saisurya3127@gmail.com"
],
"city": [
"Mumbai"
],
"state": [
"Maharashtra"
],
"country": [
"India"
],
"pincode": [
"530013"
],
"designation": [
"Software Developer"
],
"description": [
"very nice job"
],
"is_description_pdf": [
"true"
],
"compensation_ctc": [
"1200000"
],
"compensation_gross": [
"1100000"
],
"compensation_take_home": [
"1000000"
],
"compensation_bonus": [
"10000"
],
"compensation_details": [
"very good compensation"
],
"is_compensation_details_pdf": [
"true"
],
"bond_details": [
"nil"
],
"company_type": ["Private Sector"],
"nature_of_business": ["Technology"],
"website": ["www.makemytrip.com"],
"company_details": ["This s a very nice company"],
"is_company_details_pdf": ["true"],
"contact_person_name": ["Gowtham"],
"phone_number": ["9390291911"],
"email": ["saisurya3127@gmail.com"],
"city": ["Mumbai"],
"state": ["Maharashtra"],
"country": ["India"],
"pincode": ["530013"],
"designation": ["Software Developer"],
"description": ["very nice job"],
"is_description_pdf": ["true"],
"compensation_ctc": ["1200000"],
"compensation_gross": ["1100000"],
"compensation_take_home": ["1000000"],
"compensation_bonus": ["10000"],
"compensation_details": ["very good compensation"],
"is_compensation_details_pdf": ["true"],
"bond_details": ["nil"],
"selection_procedure_rounds": [
"['Resume Shortlisting', 'Technical Interview', 'HR Interview']"
],
"selection_procedure_details": [
"All rounds are complusory"
],
"is_selection_procedure_details_pdf": [
"true"
],
"tentative_date_of_joining": [
"15-01-2022"
],
"allowed_branch": [
"['CSE', 'EE']"
],
"tentative_no_of_offers": [
"5"
],
"other_requirements": [
"above 8 cpi"
],
"company_details_pdf": [
"__FILE_OBJECT__",
"__FILE_OBJECT__"
],
"description_pdf": [
"__FILE_OBJECT__"
],
"compensation_details_pdf": [
"__FILE_OBJECT__"
],
"selection_procedure_details_pdf": [
"__FILE_OBJECT__",
"__FILE_OBJECT__"
]
"selection_procedure_details": ["All rounds are complusory"],
"is_selection_procedure_details_pdf": ["true"],
"tentative_date_of_joining": ["15-01-2022"],
"allowed_branch": ["['CSE', 'EE']"],
"tentative_no_of_offers": ["5"],
"other_requirements": ["above 8 cpi"],
"company_details_pdf": ["__FILE_OBJECT__", "__FILE_OBJECT__"],
"description_pdf": ["__FILE_OBJECT__"],
"compensation_details_pdf": ["__FILE_OBJECT__"],
"selection_procedure_details_pdf": ["__FILE_OBJECT__", "__FILE_OBJECT__"]
}
```
@ -1072,7 +1440,7 @@ Response is a Json with these fields
The possible responses for this api request are as follows
| Status Codes | Possible Messages |
| ------------- | ----------------- |
| ------------- | ------------------------------ |
| 200 OK | `Placement Added Successfully` |
| 404 NOT FOUND | `Something went wrong` |
@ -1092,7 +1460,3 @@ Some common errors that you may see while accessing the Apis
| 404 NOT FOUND | `User Not Found. Contact CDC for more details` | You may not be a user at CDC, IIT Dharwad. Please contact us to get your user account |
| 400 BAD_REQUEST | `Error Occurred` | Any random Error which can be seen in the {error} string. |
| 400 BAD_REQUEST | `Something went wrong` | Any random Error which can be seen in the {error} string. |

View File

@ -5,12 +5,14 @@ certifi==2021.10.8
chardet==4.0.0
charset-normalizer==2.0.12
colorama==0.4.4
dill==0.3.5.1
dj-database-url==0.5.0
Django==3.2.13
django-background-tasks==1.2.5
django-compat==1.0.15
django-cors-headers==3.11.0
django-db-logger==0.1.12
django-simple-history==3.1.1
djangorestframework==3.13.1
google-auth==2.6.6
gunicorn==20.1.0
@ -26,17 +28,18 @@ platformdirs==2.5.1
psycopg2-binary==2.9.3
pyasn1==0.4.8
pyasn1-modules==0.2.8
PyJWT==2.4.0
pylint==2.13.5
python-dotenv==0.20.0
pytz==2022.1
PyJWT==2.3.0
requests==2.27.1
rsa==4.8
six==1.16.0
sqlparse==0.4.2
toml==0.10.2
typing_extensions==4.1.1
tomli==2.0.1
typing-extensions==4.1.1
urllib3==1.26.9
whitenoise==6.0.0
zipp==3.8.0
wrapt==1.14.0
zipp==3.8.0