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:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
HOSTING_URL: "http://localhost:8000/"
DEBUG: True
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'"
DB_NAME: cdc
DB_USER: postgres
DB_PASSWORD: postgres
DB_HOST: localhost
DB_PORT: 5432
RECAPTCHA_SECRET_KEY: 6LfpadYhAAAAAJUIJQ_JJqkqq3arvalwkVCgW3nG
GOOGLE_OAUTH_CLIENT_ID: 628308091838-nvfn455vabbq7j0odd797sls8itpplmr.apps.googleusercontent.com
RECAPTCHA_SECRET_KEY: 6LfEjvIpAAAAAJDaURb3mGrojM1ocE6MbfYHeXRz
GOOGLE_OAUTH_CLIENT_ID: 1067900363992-7ncjho5g6j2v7maaff3ba0uhh57u4nc5.apps.googleusercontent.com
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
EMAIL_ID: 200010030@iitdh.ac.in
ROLL_NO: 200010030
jobs:
build:
runs-on: ubuntu-latest
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
@ -40,25 +39,25 @@ jobs:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
strategy:
max-parallel: 4
matrix:
python-version: [3.9]
strategy:
max-parallel: 4
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Tests
run: |
cd CDC_Backend
python manage.py collectstatic
python manage.py makemigrations
python manage.py makemigrations APIs
python manage.py test
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Tests
run: |
cd CDC_Backend
python manage.py collectstatic
python manage.py makemigrations
python manage.py makemigrations APIs
python manage.py test

View File

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

View File

@ -12,6 +12,12 @@ BRANCH_CHOICES = [
['CHEMICAL', 'CHEMICAL'],
['BSMS', 'BSMS'],
]
ELIGIBLE_CHOICES = [
["Btech", "Btech"],
["MS", "MS"],
["MTech", "MTech"],
["PHD", "PHD"],
]
BRANCHES = [
"CSE",
"EE",
@ -21,6 +27,12 @@ BRANCHES = [
"CHEMICAL",
"BSMS",
]
ELIGIBLE =[
"Btech",
"MS",
"MTech",
"PHD",
]
BATCHES = [ #change it accordingly
"2023",
"2022",
@ -164,7 +176,8 @@ COMPENSATION_DETAILS_PDF_NAMES = 'compensation_details_pdf_names'
IS_COMPENSATION_DETAILS_PDF = 'is_compensation_details_pdf'
ALLOWED_BATCH = 'allowed_batch'
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
BACKLOG_ELIGIBLE = 'backlog_eligible' # 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
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
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
backlog_eligible = 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
)
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)
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

View File

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