Updated README and Minor Changes
This commit is contained in:
parent
920bd4f77f
commit
f518df9d78
|
@ -8,10 +8,10 @@ from rest_framework.decorators import api_view
|
||||||
def markStatus(request, id, email, user_type):
|
def markStatus(request, id, email, user_type):
|
||||||
try:
|
try:
|
||||||
data = request.data
|
data = request.data
|
||||||
applications = PlacementApplication.objects.filter(placement_id=data[OPENING_ID]) # Getting All
|
applications = PlacementApplication.objects.filter(placement_id=data[OPENING_ID]) # Getting All
|
||||||
# application form db for this opening
|
# application from db for this opening
|
||||||
for i in data[STUDENT_LIST]:
|
for i in data[STUDENT_LIST]:
|
||||||
application = applications.filter(student_id=i[STUDENT_ID]) # Filtering student's application
|
application = applications.filter(student_id=i[STUDENT_ID]) # Filtering student's application
|
||||||
if len(application) > 0:
|
if len(application) > 0:
|
||||||
application = application[0]
|
application = application[0]
|
||||||
application.selected = i[STUDENT_STATUS]
|
application.selected = i[STUDENT_STATUS]
|
||||||
|
@ -24,7 +24,7 @@ def markStatus(request, id, email, user_type):
|
||||||
"designation": application.placement.designation,
|
"designation": application.placement.designation,
|
||||||
"student_name": application.student.name
|
"student_name": application.student.name
|
||||||
}
|
}
|
||||||
if application.selected: # Sending corresponding email to students
|
if application.selected: # Sending corresponding email to students
|
||||||
sendEmail(email, subject, data, STUDENT_APPLICATION_STATUS_SELECTED_TEMPLATE)
|
sendEmail(email, subject, data, STUDENT_APPLICATION_STATUS_SELECTED_TEMPLATE)
|
||||||
# This one needs to be created
|
# This one needs to be created
|
||||||
else:
|
else:
|
||||||
|
@ -32,10 +32,13 @@ def markStatus(request, id, email, user_type):
|
||||||
# This one needs to be created
|
# This one needs to be created
|
||||||
else:
|
else:
|
||||||
raise ValueError("Student - " + i[STUDENT_ID] + " didn't apply for this opening")
|
raise ValueError("Student - " + i[STUDENT_ID] + " didn't apply for this opening")
|
||||||
|
return Response({'action': "Mark Status", 'message': "Marked Status"},
|
||||||
|
status=status.HTTP_200_OK)
|
||||||
|
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
return Response({'action': "Mark Selected", 'message': str(e)},
|
return Response({'action': "Mark Status", 'message': str(e)},
|
||||||
status=status.HTTP_400_BAD_REQUEST)
|
status=status.HTTP_400_BAD_REQUEST)
|
||||||
except:
|
except:
|
||||||
logger.warning("Mark Status: " + str(sys.exc_info()))
|
logger.warning("Mark Status: " + str(sys.exc_info()))
|
||||||
return Response({'action': "Mark Stauts", 'message': "Error Occurred!"},
|
return Response({'action': "Mark Status", 'message': "Error Occurred!"},
|
||||||
status=status.HTTP_400_BAD_REQUEST)
|
status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
3. [**api/student/addResume/**](#apistudentaddresume)
|
3. [**api/student/addResume/**](#apistudentaddresume)
|
||||||
4. [**api/student/deleteResume/**](#apistudentdeleteresume)
|
4. [**api/student/deleteResume/**](#apistudentdeleteresume)
|
||||||
5. [**api/student/submitApplication/**](#apistudentsubmitapplication)
|
5. [**api/student/submitApplication/**](#apistudentsubmitapplication)
|
||||||
3. [**Common Errors**](#common-errors)
|
3. [**Admin APIs**](#admin-portal-apis)
|
||||||
|
1. [**api/admin/markStatus/**](#apiadminmarkstatus)
|
||||||
|
4. [**Common Errors**](#common-errors)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -390,6 +392,58 @@ You can see some common errors [here](#common-errors)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
# Admin Portal APIs
|
||||||
|
|
||||||
|
## `api/admin/markStatus`
|
||||||
|
|
||||||
|
This Api is used to mark the status for application for a specific placement.
|
||||||
|
|
||||||
|
### How to Use?
|
||||||
|
|
||||||
|
Send a `POST` request to `api/admin/markStatus`<br>
|
||||||
|
Request_Body:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"opening_id": "RIDNK323JD3JD",
|
||||||
|
"student_list": [
|
||||||
|
"DBJDH32JDDDRE",
|
||||||
|
"HFJGJHE7JGDHE"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
> Headers <br>
|
||||||
|
> Authorization: "Bearer {tokenID}"
|
||||||
|
|
||||||
|
### Response
|
||||||
|
|
||||||
|
Response is a Json with these fields
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"action": "Mark Status",
|
||||||
|
"message": "Marked Status"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- 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 | `Marked Status` |
|
||||||
|
| 400 BAD_REQUEST | `Error Occurred` |
|
||||||
|
|
||||||
|
You may see some different errors which can be seen [here](#common-errors)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## `Common Errors`
|
## `Common Errors`
|
||||||
|
|
||||||
Some common errors that you may see while accessing the Apis
|
Some common errors that you may see while accessing the Apis
|
||||||
|
@ -401,3 +455,5 @@ Some common errors that you may see while accessing the Apis
|
||||||
| 401 UNAUTHORIZED | `Token has wrong audience` | You may be using wrong credentials for Google OAuth2.0. |
|
| 401 UNAUTHORIZED | `Token has wrong audience` | You may be using wrong credentials for Google OAuth2.0. |
|
||||||
| 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 |
|
| 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 {error}` | Any random Error which can be seen in the {error} string. |
|
| 400 BAD_REQUEST | `Error Occurred {error}` | Any random Error which can be seen in the {error} string. |
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue