This commit is contained in:
NitinVangipuram 2024-07-19 11:56:33 +05:30
parent 6cf27e52a4
commit 32a52f9567
5 changed files with 107 additions and 75 deletions

View File

@ -1,33 +1,32 @@
name: Django CI name: Django CI
on: on:
push: push:
branches: [ "main" ] branches: ["main"]
pull_request: pull_request:
branches: [ "main" ] branches: ["main"]
env: env:
HOSTING_URL: "http://localhost:8000/" HOSTING_URL: "http://localhost:8000/"
DEBUG: True DEBUG: True
EMAIL: karthik.murakonda14@gmail.com EMAIL: karthik.murakonda14@gmail.com
EMAIL_PASSWORD: 1234567890 EMAIL_PASSWORD: 12345678901
EMAIL_VERIFICATION_SECRET_KEY: "b'<\xa3\xaf&d6\xa9sf\x19$\x96\xb7\x90\x8b\x88\x84\x0e\x191\xde,M\x90\x17(\xf7\nG\x13\x8d$\x9f&\xb0\xcd\xa4\xaf\xa9\x1b\x15\x02B\x8a\xaf\xff\x0c\x1e\xd5\xb3\x06\xb8\xa6\x9bQ\xa0TR\xe8\x98\x9ae\xe0n}\xcc/[\xdaFz\x18\xfeX\xaf\xbd\xd0\x88\xeal\xe3\xd2\xe3\xb8\x8c\x199{\xf3<\xb0\xc5\xd0\xe7*Rv\xda\xbb \x1d\x85~\xff%>\x1e\xb8\xa7\xbf\xbc\xb2\x06\x86X\xc3\x9f\x13<\x9fd\xea\xb5\x01\xa4\x7f\xa0\x1b\x8bO\x01h\xe8\xfd\x1f\xfe\xba\xbeg\\\xc2\xcb\xc3\xd1~\xff\xd5/9d\xa8\xa7x{\x16\xdb\\\xbb\x08\rI\xcd\x9e7\x8c~\x0f\x1d\x81rXZD\xf0\xf7\x87K\x8f\xfb,\xf4\xf0\xa5\x9e\xde^\xca\xae\x80|9b\x9b\xaaE\xba\xfb\xdf\x80\xb1\x99\x83e[\xf8\xce&Rq\x99\xdb}\xeeO\xd5\x18\x8d\x0bv\xe7\xab\xf9\xb9{\xb5u\xce\xcf\x90\xa6HE\xc5\x92p\x00\x158\xdf'" EMAIL_VERIFICATION_SECRET_KEY: "b'<\xa3\xaf&d6\xa9sf\x19$\x96\xb7\x90\x8b\x88\x84\x0e\x191\xde,M\x90\x17(\xf7\nG\x13\x8d$\x9f&\xb0\xcd\xa4\xaf\xa9\x1b\x15\x02B\x8a\xaf\xff\x0c\x1e\xd5\xb3\x06\xb8\xa6\x9bQ\xa0TR\xe8\x98\x9ae\xe0n}\xcc/[\xdaFz\x18\xfeX\xaf\xbd\xd0\x88\xeal\xe3\xd2\xe3\xb8\x8c\x199{\xf3<\xb0\xc5\xd0\xe7*Rv\xda\xbb \x1d\x85~\xff%>\x1e\xb8\xa7\xbf\xbc\xb2\x06\x86X\xc3\x9f\x13<\x9fd\xea\xb5\x01\xa4\x7f\xa0\x1b\x8bO\x01h\xe8\xfd\x1f\xfe\xba\xbeg\\\xc2\xcb\xc3\xd1~\xff\xd5/9d\xa8\xa7x{\x16\xdb\\\xbb\x08\rI\xcd\x9e7\x8c~\x0f\x1d\x81rXZD\xf0\xf7\x87K\x8f\xfb,\xf4\xf0\xa5\x9e\xde^\xca\xae\x80|9b\x9b\xaaE\xba\xfb\xdf\x80\xb1\x99\x83e[\xf8\xce&Rq\x99\xdb}\xeeO\xd5\x18\x8d\x0bv\xe7\xab\xf9\xb9{\xb5u\xce\xcf\x90\xa6HE\xc5\x92p\x00\x158\xdf'"
DB_NAME: cdc DB_NAME: cdc
DB_USER: postgres DB_USER: postgres
DB_PASSWORD: postgres DB_PASSWORD: postgres
DB_HOST: localhost DB_HOST: localhost
DB_PORT: 5432 DB_PORT: 5432
RECAPTCHA_SECRET_KEY: 6LfpadYhAAAAAJUIJQ_JJqkqq3arvalwkVCgW3nG RECAPTCHA_SECRET_KEY: 6LfEjvIpAAAAAJDaURb3mGrojM1ocE6MbfYHeXRz
GOOGLE_OAUTH_CLIENT_ID: 628308091838-nvfn455vabbq7j0odd797sls8itpplmr.apps.googleusercontent.com GOOGLE_OAUTH_CLIENT_ID: 1067900363992-7ncjho5g6j2v7maaff3ba0uhh57u4nc5.apps.googleusercontent.com
SECRET_KEY: 9%2e!&f6(ib^690y48z)&w6fczhwukzzp@3y*^*7u+7%4s-mie SECRET_KEY: 9%2e!&f6(ib^690y48z)&w6fczhwukzzp@3y*^*7u+7%4s-mie
GOOGLE_OAUTH_CLIENT_SECRET: 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 GOOGLE_OAUTH_CLIENT_SECRET: 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
REFRESH_TOKEN: 1//0gCf5fxAgSqNcCgYIARAAGBASNwF-L9IrIWxWwqmboeJkEzVn0sqxbaeyWXODE5s24V7pSdiAzFM2cxOUC9XT_xp7t_60o3JMfOg REFRESH_TOKEN: 1//0gCf5fxAgSqNcCgYIARAAGBASNwF-L9IrIWxWwqmboeJkEzVn0sqxbaeyWXODE5s24V7pSdiAzFM2cxOUC9XT_xp7t_60o3JMfOg
EMAIL_ID: 200010030@iitdh.ac.in EMAIL_ID: 200010030@iitdh.ac.in
ROLL_NO: 200010030 ROLL_NO: 200010030
jobs: jobs:
build: build:
runs-on: ubuntu-latest
runs-on: ubuntu-latest
services: services:
postgres: postgres:
@ -41,24 +40,24 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
strategy: strategy:
max-parallel: 4 max-parallel: 4
matrix: matrix:
python-version: [3.9] python-version: [3.9]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3 uses: actions/setup-python@v3
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Install Dependencies - name: Install Dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
- name: Run Tests - name: Run Tests
run: | run: |
cd CDC_Backend cd CDC_Backend
python manage.py collectstatic python manage.py collectstatic
python manage.py makemigrations python manage.py makemigrations
python manage.py makemigrations APIs python manage.py makemigrations APIs
python manage.py test python manage.py test

View File

@ -7,14 +7,14 @@ logger = logging.getLogger('db')
@api_view(['POST']) @api_view(['POST'])
# @precheck([COMPANY_NAME, ADDRESS, COMPANY_TYPE, NATURE_OF_BUSINESS, TYPE_OF_ORGANISATION, WEBSITE, COMPANY_DETAILS, @precheck([COMPANY_NAME, ADDRESS, COMPANY_TYPE, NATURE_OF_BUSINESS, TYPE_OF_ORGANISATION, WEBSITE, COMPANY_DETAILS,
# IS_COMPANY_DETAILS_PDF, CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL, CITY, STATE, COUNTRY, PINCODE, DESIGNATION, IS_COMPANY_DETAILS_PDF, CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL, CITY, STATE, COUNTRY, PINCODE, DESIGNATION,
# DESCRIPTION, DESCRIPTION,
# IS_DESCRIPTION_PDF, COMPENSATION_CTC, COMPENSATION_GROSS, COMPENSATION_TAKE_HOME, COMPENSATION_BONUS, IS_DESCRIPTION_PDF, COMPENSATION_CTC, COMPENSATION_GROSS, COMPENSATION_TAKE_HOME, COMPENSATION_BONUS,
# IS_COMPENSATION_DETAILS_PDF, ALLOWED_BRANCH, RS_ELIGIBLE, SELECTION_PROCEDURE_ROUNDS, IS_COMPENSATION_DETAILS_PDF, ALLOWED_BRANCH, ELIGIBLESTUDENTS, SELECTION_PROCEDURE_ROUNDS,
# SELECTION_PROCEDURE_DETAILS, SELECTION_PROCEDURE_DETAILS,
# IS_SELECTION_PROCEDURE_DETAILS_PDF, TENTATIVE_DATE_OF_JOINING, TENTATIVE_NO_OF_OFFERS, OTHER_REQUIREMENTS, IS_SELECTION_PROCEDURE_DETAILS_PDF, TENTATIVE_DATE_OF_JOINING, TENTATIVE_NO_OF_OFFERS, OTHER_REQUIREMENTS,
# RECAPTCHA_VALUE, JOB_LOCATION,PSYCHOMETRIC_TEST,MEDICAL_TEST,COMPANY_TURNOVER,NUMBER_OF_EMPLOYEES,BACKLOG_ELIGIBLE,PWD_ELIGIBLE,CPI ,COMPANY_TURNOVER,ESTABLISHMENT_DATE ,EXPECTED_NO_OF_OFFERS]) RECAPTCHA_VALUE, JOB_LOCATION,PSYCHOMETRIC_TEST,MEDICAL_TEST,COMPANY_TURNOVER,NUMBER_OF_EMPLOYEES,BACKLOG_ELIGIBLE,PWD_ELIGIBLE,CPI ,COMPANY_TURNOVER,ESTABLISHMENT_DATE ,EXPECTED_NO_OF_OFFERS])
def addPlacement(request): def addPlacement(request):
logger.info("JNF filled by " + str(request.data['email'])) logger.info("JNF filled by " + str(request.data['email']))
@ -40,6 +40,14 @@ def addPlacement(request):
# opening.rs_eligible = True # opening.rs_eligible = True
# else: # else:
# opening.rs_eligible = False # opening.rs_eligible = False
print(data[ELIGIBLESTUDENTS])
if data[ELIGIBLESTUDENTS] is None:
raise ValueError('Eligible Students cannot be empty')
elif set(json.loads(data[ELIGIBLESTUDENTS])).issubset(ELIGIBLE):
opening.eligiblestudents = json.loads(data[ELIGIBLESTUDENTS])
else:
raise ValueError('Allowed Branch must be a subset of ' + str(ELIGIBLE))
print(opening.eligiblestudents)
if data[PWD_ELIGIBLE] == 'Yes': if data[PWD_ELIGIBLE] == 'Yes':
opening.pwd_eligible = True opening.pwd_eligible = True
else: else:
@ -270,20 +278,19 @@ def addPlacement(request):
except ValueError as e: except ValueError as e:
store_all_files(request) store_all_files(request)
#exception_email(data)
logger.warning("ValueError in addPlacement: " + str(e)) logger.warning("ValueError in addPlacement: " + str(e))
logger.warning(traceback.format_exc()) logger.warning(traceback.format_exc())
return Response({'action': "Add Placement", 'message': str(e)}, return Response({'action': "Add Placement", 'message': str(e)},
status=status.HTTP_400_BAD_REQUEST) status=status.HTTP_400_BAD_REQUEST)
except: except Exception as e:
store_all_files(request) store_all_files(request)
#exception_email(data) logger.warning("Add New Placement: " + str(e))
logger.warning("Add New Placement: " + str(sys.exc_info()))
logger.warning(traceback.format_exc()) logger.warning(traceback.format_exc())
return Response({'action': "Add Placement", 'message': "Something went wrong"}, return Response({'action': "Add Placement", 'message': "Something went wrong: " + str(e)},
status=status.HTTP_400_BAD_REQUEST) status=status.HTTP_400_BAD_REQUEST)
@api_view(['POST']) @api_view(['POST'])
@precheck([TOKEN]) @precheck([TOKEN])
def verifyEmail(request): def verifyEmail(request):
@ -381,13 +388,13 @@ def autoFillInf(request):
@api_view(['POST']) @api_view(['POST'])
# @precheck([COMPANY_NAME, WEBSITE, IS_COMPANY_DETAILS_PDF, COMPANY_DETAILS, ADDRESS, @precheck([COMPANY_NAME, WEBSITE, IS_COMPANY_DETAILS_PDF, COMPANY_DETAILS, ADDRESS,
# CITY, STATE, COUNTRY, PINCODE, COMPANY_TYPE, NATURE_OF_BUSINESS, IS_DESCRIPTION_PDF, CITY, STATE, COUNTRY, PINCODE, COMPANY_TYPE, NATURE_OF_BUSINESS, IS_DESCRIPTION_PDF,
# DESIGNATION, INTERNSHIP_LOCATION, DESCRIPTION, SEASON, START_DATE, END_DATE, WORK_TYPE, DESIGNATION, INTERNSHIP_LOCATION, DESCRIPTION, SEASON, START_DATE, END_DATE, WORK_TYPE,
# ALLOWED_BRANCH, SOPHOMORES_ELIIGIBLE, RS_ELIGIBLE, NUM_OFFERS, IS_STIPEND_DETAILS_PDF, STIPEND, ALLOWED_BRANCH, ELIGIBLESTUDENTS, NUM_OFFERS, IS_STIPEND_DETAILS_PDF, STIPEND,
# FACILITIES, OTHER_FACILITIES, SELECTION_PROCEDURE_ROUNDS, SELECTION_PROCEDURE_DETAILS, IS_SELECTION_PROCEDURE_DETAILS_PDF, FACILITIES, OTHER_FACILITIES, SELECTION_PROCEDURE_ROUNDS, SELECTION_PROCEDURE_DETAILS, IS_SELECTION_PROCEDURE_DETAILS_PDF,
# SELECTION_PROCEDURE_DETAILS, OTHER_REQUIREMENTS, SELECTION_PROCEDURE_DETAILS, OTHER_REQUIREMENTS,
# CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL, RECAPTCHA_VALUE]) CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL, RECAPTCHA_VALUE ,ESTABLISHMENT_DATE,PWD_ELIGIBLE,BACKLOG_ELIGIBLE,PSYCHOMETRIC_TEST,MEDICAL_TEST,CPI,EXPECTED_NO_OF_OFFERS,NUMBER_OF_EMPLOYEES,COMPANY_TURNOVER])
def addInternship(request): def addInternship(request):
logger.info("INF filled by " + str(request.data['email'])) logger.info("INF filled by " + str(request.data['email']))
logger.info(request.data) logger.info(request.data)
@ -473,10 +480,13 @@ def addInternship(request):
# internship.sophomore_eligible = True # internship.sophomore_eligible = True
# else: # else:
# internship.sophomore_eligible = False # internship.sophomore_eligible = False
# if data[RS_ELIGIBLE] == 'Yes': if data[ELIGIBLESTUDENTS] is None:
# internship.rs_eligible = True raise ValueError('Eligible Students cannot be empty')
# else: elif set(json.loads(data[ELIGIBLESTUDENTS])).issubset(ELIGIBLE):
# internship.rs_eligible = False internship.eligiblestudents = json.loads(data[ELIGIBLESTUDENTS])
else:
raise ValueError('Allowed Branch must be a subset of ' + str(ELIGIBLE))
print(internship.eligiblestudents)
if data[PWD_ELIGIBLE] == 'Yes': if data[PWD_ELIGIBLE] == 'Yes':
internship.pwd_eligible = True internship.pwd_eligible = True
else: else:
@ -598,15 +608,15 @@ def addInternship(request):
status=status.HTTP_200_OK) status=status.HTTP_200_OK)
except ValueError as e: except ValueError as e:
store_all_files(request) store_all_files(request)
# exception_email(data)
logger.warning("ValueError in addInternship: " + str(e)) logger.warning("ValueError in addInternship: " + str(e))
logger.warning(traceback.format_exc()) logger.warning(traceback.format_exc())
return Response({'action': "Add Internship", 'message': str(e)}, return Response({'action': "Add Internship", 'message': str(e)},
status=status.HTTP_400_BAD_REQUEST) status=status.HTTP_400_BAD_REQUEST)
except: except Exception as e:
store_all_files(request) store_all_files(request)
# exception_email(data) logger.warning("Add New Internship: " + str(e))
logger.warning("Add New Internship: " + str(sys.exc_info()))
logger.warning(traceback.format_exc()) logger.warning(traceback.format_exc())
return Response({'action': "Add Internship", 'message': "Something went wrong"}, return Response({'action': "Add Internship", 'message': "Something went wrong: " + str(e)},
status=status.HTTP_400_BAD_REQUEST) status=status.HTTP_400_BAD_REQUEST)

View File

@ -12,6 +12,12 @@ BRANCH_CHOICES = [
['CHEMICAL', 'CHEMICAL'], ['CHEMICAL', 'CHEMICAL'],
['BSMS', 'BSMS'], ['BSMS', 'BSMS'],
] ]
ELIGIBLE_CHOICES = [
["Btech", "Btech"],
["MS", "MS"],
["MTech", "MTech"],
["PHD", "PHD"],
]
BRANCHES = [ BRANCHES = [
"CSE", "CSE",
"EE", "EE",
@ -21,6 +27,12 @@ BRANCHES = [
"CHEMICAL", "CHEMICAL",
"BSMS", "BSMS",
] ]
ELIGIBLE =[
"Btech",
"MS",
"MTech",
"PHD",
]
BATCHES = [ #change it accordingly BATCHES = [ #change it accordingly
"2023", "2023",
"2022", "2022",
@ -164,7 +176,8 @@ COMPENSATION_DETAILS_PDF_NAMES = 'compensation_details_pdf_names'
IS_COMPENSATION_DETAILS_PDF = 'is_compensation_details_pdf' IS_COMPENSATION_DETAILS_PDF = 'is_compensation_details_pdf'
ALLOWED_BATCH = 'allowed_batch' ALLOWED_BATCH = 'allowed_batch'
ALLOWED_BRANCH = 'allowed_branch' ALLOWED_BRANCH = 'allowed_branch'
RS_ELIGIBLE = 'rs_eligible' # RS_ELIGIBLE = 'rs_eligible' removed
ELIGIBLESTUDENTS= 'eligiblestudents'# newly adde field
PWD_ELIGIBLE = 'pwd_eligible' # newly added field PWD_ELIGIBLE = 'pwd_eligible' # newly added field
BACKLOG_ELIGIBLE = 'backlog_eligible' # newly added field BACKLOG_ELIGIBLE = 'backlog_eligible' # newly added field
PSYCHOMETRIC_TEST = 'pyschometric_test' # newly added field PSYCHOMETRIC_TEST = 'pyschometric_test' # newly added field

View File

@ -142,6 +142,11 @@ class Placement(models.Model):
expected_no_of_offers = models.IntegerField(blank=False , default=None , null=True) # newly added expected_no_of_offers = models.IntegerField(blank=False , default=None , null=True) # newly added
number_of_employees = models.IntegerField(blank=False, default=None, null=True) # newly added field number_of_employees = models.IntegerField(blank=False, default=None, null=True) # newly added field
rs_eligible = models.BooleanField(blank=True, default=False) # needs to be deleted rs_eligible = models.BooleanField(blank=True, default=False) # needs to be deleted
eligiblestudents = ArrayField(
models.CharField(choices=ELIGIBLE_CHOICES, blank=False, max_length=10),
size=10,
default=list
)
pwd_eligible = models.BooleanField(blank=True, default=False) #newly added field pwd_eligible = models.BooleanField(blank=True, default=False) #newly added field
backlog_eligible = models.BooleanField(blank=True, default=False) #newly added field backlog_eligible = models.BooleanField(blank=True, default=False) #newly added field
psychometric_test = models.BooleanField(blank=True, default=False) #newly added field psychometric_test = models.BooleanField(blank=True, default=False) #newly added field
@ -334,7 +339,12 @@ class Internship(models.Model):
default=list default=list
) )
sophomore_eligible = models.BooleanField(blank=False, default=False) sophomore_eligible = models.BooleanField(blank=False, default=False)
rs_eligible = models.BooleanField(blank=False, default=False) rs_eligible = models.BooleanField(blank=False, default=False) # needs to be deleted
eligiblestudents = ArrayField(
models.CharField(choices=ELIGIBLE_CHOICES, blank=False, max_length=10),
size=10,
default=list
)
tentative_no_of_offers = models.IntegerField(blank=False, default=None, null=True) tentative_no_of_offers = models.IntegerField(blank=False, default=None, null=True)
company_turnover = models.IntegerField(blank=True, default=None, null=True) # newly added field company_turnover = models.IntegerField(blank=True, default=None, null=True) # newly added field
establishment_date = models.DateField(blank=True, default=None, null=True) # newly added field establishment_date = models.DateField(blank=True, default=None, null=True) # newly added field

View File

@ -81,22 +81,22 @@ def precheck(required_data=None):
request_data = request.data request_data = request.data
if not len(request_data): if not len(request_data):
request_data = request.POST request_data = request.POST
if len(request_data):
if request_data and len(request_data):
for i in required_data: for i in required_data:
# print(i)
if i not in request_data: if i not in request_data:
return Response({'action': "Pre check", 'message': str(i) + " Not Found"}, return Response({'action': "Pre check", 'message': str(i) + " Not Found"},
status=status.HTTP_400_BAD_REQUEST) status=status.HTTP_400_BAD_REQUEST)
else: else:
return Response({'action': "Pre check", 'message': "Message Data not Found"}, return Response({'action': "Pre check", 'message': "Message Data not Found"},
status=status.HTTP_400_BAD_REQUEST) status=status.HTTP_400_BAD_REQUEST)
# print("Pre check: " + str(request_data))
return view_func(request, *args, **kwargs) return view_func(request, *args, **kwargs)
except:
# print what exception is except Exception as e:
print(traceback.format_exc()) # Log the full traceback for debugging purposes
logger.warning("Pre check: " + str(sys.exc_info())) logger.error("Pre check error: %s", traceback.format_exc())
return Response({'action': "Pre check", 'message': "Something went wrong"}, return Response({'action': "Pre check", 'message': "Something went wrong: " + str(e)},
status=status.HTTP_400_BAD_REQUEST) status=status.HTTP_400_BAD_REQUEST)
return wrapper_func return wrapper_func