From f518df9d7865ff1a9b08a7244824759fd3873e88 Mon Sep 17 00:00:00 2001
From: gowtham3105 <66207607+gowtham3105@users.noreply.github.com>
Date: Mon, 25 Oct 2021 23:09:09 +0530
Subject: [PATCH] Updated README and Minor Changes
---
CDC_Backend/APIs/adminViews.py | 15 +++++----
CDC_Backend/README.md | 58 +++++++++++++++++++++++++++++++++-
2 files changed, 66 insertions(+), 7 deletions(-)
diff --git a/CDC_Backend/APIs/adminViews.py b/CDC_Backend/APIs/adminViews.py
index 92b8ef9..b72de2a 100644
--- a/CDC_Backend/APIs/adminViews.py
+++ b/CDC_Backend/APIs/adminViews.py
@@ -8,10 +8,10 @@ from rest_framework.decorators import api_view
def markStatus(request, id, email, user_type):
try:
data = request.data
- applications = PlacementApplication.objects.filter(placement_id=data[OPENING_ID]) # Getting All
- # application form db for this opening
+ applications = PlacementApplication.objects.filter(placement_id=data[OPENING_ID]) # Getting All
+ # application from db for this opening
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:
application = application[0]
application.selected = i[STUDENT_STATUS]
@@ -24,7 +24,7 @@ def markStatus(request, id, email, user_type):
"designation": application.placement.designation,
"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)
# This one needs to be created
else:
@@ -32,10 +32,13 @@ def markStatus(request, id, email, user_type):
# This one needs to be created
else:
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:
- return Response({'action': "Mark Selected", 'message': str(e)},
+ return Response({'action': "Mark Status", 'message': str(e)},
status=status.HTTP_400_BAD_REQUEST)
except:
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)
diff --git a/CDC_Backend/README.md b/CDC_Backend/README.md
index e186f4b..ef1364a 100644
--- a/CDC_Backend/README.md
+++ b/CDC_Backend/README.md
@@ -7,7 +7,9 @@
3. [**api/student/addResume/**](#apistudentaddresume)
4. [**api/student/deleteResume/**](#apistudentdeleteresume)
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`
+Request_Body:
+
+```json
+{
+ "opening_id": "RIDNK323JD3JD",
+ "student_list": [
+ "DBJDH32JDDDRE",
+ "HFJGJHE7JGDHE"
+ ]
+}
+```
+
+> Headers
+> 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
+- 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`
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. |
| 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. |
+
+