diff --git a/SE_API/CampusRoutes.py b/SE_API/CampusRoutes.py
index e17bc44..8c8b02e 100644
--- a/SE_API/CampusRoutes.py
+++ b/SE_API/CampusRoutes.py
@@ -119,9 +119,7 @@ def get_campuses(token):
]
403 - Invalid Token
- 500 - Server Error
"""
-
if is_user_token_valid(token):
arr = []
query = Campus.all()
diff --git a/SE_API/CourseRoutes.py b/SE_API/CourseRoutes.py
index 95a2539..4bae4ea 100644
--- a/SE_API/CourseRoutes.py
+++ b/SE_API/CourseRoutes.py
@@ -31,20 +31,30 @@ auto = Autodoc()
@auto.doc()
def create_course(token):
"""
- This call will create a new campus in the DB
- :param token: user seToken
- Payload
- {
- 'courseName': self.courseName,
- 'campusName': self.campusName,
- 'projects': self.projects
- 'startDate': self.startDate
- 'endDate': self.endDate
- 'taskFlag': self.taskFlag
- }
-
- :return:
- code 200
+ This call will create a new course in the DB
+
+ Route Parameters
+ - seToken: 'seToken'
+
+
+ Payload
+ - JSON Object, Example:
+ {
+ 'courseName': 'Advance Math',
+ 'campusName': 'JCE',
+ 'startDate': '2015-14-3'
+ 'endDate': '2015-29-6'
+ 'taskFlag': 'False'
+ }
+
+
+ Response
+
+ 201 - Created
+
+ 400 - Bad Request
+
+ 403 - Invalid token or not a lecturer
"""
if not request.data:
return bad_request()
@@ -64,6 +74,9 @@ def create_course(token):
start_date = datetime.date(payload['startDate']['year'],payload['startDate']['month'],payload['startDate']['day'])
end_date = datetime.date(payload['endDate']['year'],payload['endDate']['month'],payload['endDate']['day'])
+ if end_date <= start_date:
+ return bad_request("end date cant be before (or same day) start date")
+
course = Course(courseName=payload['courseName'], campusName=payload['campusName'],
startDate=start_date, endDate=end_date)
@@ -76,12 +89,6 @@ def create_course(token):
except Exception as e:
print e
- #check if and projects needs to be added
- # try:
- # course.projects=payload['projects']
- # except Exception:
- # pass
-
except Exception:
return bad_request()
@@ -99,11 +106,11 @@ def create_course(token):
@course_routes.route('/api/courses/getCourseByCampusName/', methods=["GET"])
@auto.doc()
def getCourseByCampusName(name):
- '''
- This Function is will Activate a user and add tha campus to it
+ """
+ >This Call will return an array of all courses in a given campus
Route Parameters
- - validation_token: 'seToken|email_suffix'
+ - name: 'campus name'
Payload
@@ -115,21 +122,15 @@ def getCourseByCampusName(name):
200 - JSON Example:
{
- 'username' : 'github_username',
- 'name' : 'Bob Dylan',
- 'email' : 'email@domain.com',
- 'isLecturer' : true,
- 'seToken' : 'dds2d-sfvvsf-qqq-fdf33-sfaa',
- 'avatar_url' : 'http://location.domain.com/image.jpg',
- 'isFirstLogin' : false,
- 'campuses_id_list': ['22314','243512',...,'356'],
- 'classes_id_list': ['22314','243512',...,'356']
+ 'courseName': 'Advance Math',
+ 'campusName': 'JCE',
+ 'startDate': '2015-14-3'
+ 'endDate': '2015-29-6'
+ 'taskFlag': 'False'
}
- 403 - Invalid Token
- '''
-
+ """
arr = []
query = Course.all()
query.filter("campusName = ", name)
diff --git a/SE_API/ProjectRoutes.py b/SE_API/ProjectRoutes.py
index 46d35cc..18d2fb1 100644
--- a/SE_API/ProjectRoutes.py
+++ b/SE_API/ProjectRoutes.py
@@ -39,9 +39,10 @@ def create_project(token):
Payload
- JSON Object, Example:
{
- 'title': 'Campus name',
- 'email_ending': '@campus.ac.com',
- 'avatar_url': 'http://location.domain.com/image.jpg'
+ 'projectName': 'Advance Math',
+ 'courseName': 'JCE',
+ 'logo_url': 'http://location.domain.com/image.jpg'
+ 'gitRepository': 'http://location.git.com/somthing'
}
@@ -49,7 +50,9 @@ def create_project(token):
201 - Created
- 403 - Invalid Token/Forbidden
+ 400 - Bad Request
+
+ 403 - Invalid token or not a lecturer
"""
if not request.data:
return bad_request()
@@ -80,11 +83,11 @@ def create_project(token):
@project_routes.route('/api/projects/getProjectsByCourseName/', methods=["GET"])
@auto.doc()
def getProjectsByCourseName(name):
- '''
- This Function is will Activate a user and add tha campus to it
+ """
+ >This Call will return an array of all projects in a given course
Route Parameters
- - validation_token: 'seToken|email_suffix'
+ - name: 'course name'
Payload
@@ -96,20 +99,16 @@ def getProjectsByCourseName(name):
200 - JSON Example:
{
- 'username' : 'github_username',
- 'name' : 'Bob Dylan',
- 'email' : 'email@domain.com',
- 'isLecturer' : true,
- 'seToken' : 'dds2d-sfvvsf-qqq-fdf33-sfaa',
- 'avatar_url' : 'http://location.domain.com/image.jpg',
- 'isFirstLogin' : false,
- 'campuses_id_list': ['22314','243512',...,'356'],
- 'classes_id_list': ['22314','243512',...,'356']
+ 'projectName': 'Advance Math',
+ 'courseName': 'JCE',
+ 'grade': 98,
+ 'logo_url': 'http://location.domain.com/image.jpg',
+ 'gitRepository': 'http://location.git.com/somthing',
+ 'membersId': ['bob', 'dylan', 'quentin', 'terentino']
}
- 403 - Invalid Token
- '''
+ """
arr = []
query = Project.all()