commit
d5354b014e
1 changed files with 51 additions and 3 deletions
|
@ -254,9 +254,8 @@ def create_campus(token):
|
||||||
<br>
|
<br>
|
||||||
403 - Invalid Token/Forbidden
|
403 - Invalid Token/Forbidden
|
||||||
"""
|
"""
|
||||||
print "1\n"
|
|
||||||
if not request.data:
|
if not request.data:
|
||||||
return Response(response=json.dumps({'message': 'Bad Request0'}),
|
return Response(response=json.dumps({'message': 'Bad Request'}),
|
||||||
status=400,
|
status=400,
|
||||||
mimetype="application/json")
|
mimetype="application/json")
|
||||||
payload = json.loads(request.data)
|
payload = json.loads(request.data)
|
||||||
|
@ -272,7 +271,7 @@ def create_campus(token):
|
||||||
try:
|
try:
|
||||||
campus = Campus(title=payload['title'], email_ending=payload['email_ending'], master_user_id=user.key().id(), avatar_url=payload['avatar_url'])
|
campus = Campus(title=payload['title'], email_ending=payload['email_ending'], master_user_id=user.key().id(), avatar_url=payload['avatar_url'])
|
||||||
except Exception:
|
except Exception:
|
||||||
return Response(response=json.dumps({'message': 'Bad Request1'}),
|
return Response(response=json.dumps({'message': 'Bad Request'}),
|
||||||
status=400,
|
status=400,
|
||||||
mimetype="application/json")
|
mimetype="application/json")
|
||||||
|
|
||||||
|
@ -284,6 +283,55 @@ def create_campus(token):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# @app.route('/api/Courses/create/<string:token>', methods=['POST'])
|
||||||
|
# @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
|
||||||
|
# """
|
||||||
|
# if not request.data:
|
||||||
|
# return Response(response=json.dumps({'message': 'Bad Request'}),
|
||||||
|
# status=400,
|
||||||
|
# mimetype="application/json")
|
||||||
|
# payload = json.loads(request.data)
|
||||||
|
# if not is_lecturer(token): #todo: change to lecturer id
|
||||||
|
# return Response(response=json.dumps({'message': 'Invalid token or not a lecturer!'}),
|
||||||
|
# status=403,
|
||||||
|
# mimetype="application/json")
|
||||||
|
#
|
||||||
|
# user = get_user_by_token(token)
|
||||||
|
#
|
||||||
|
# #todo: check legality
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# try:
|
||||||
|
# course = Course(courseName=payload['courseName'], campusName=payload['campusName'], projects=payload['projects'], startDate=payload['startDate'], endDate=payload['endDate'], taskFlag=payload['taskFlag'])
|
||||||
|
# except Exception:
|
||||||
|
# return Response(response=json.dumps({'message': 'Bad Request'}),
|
||||||
|
# status=400,
|
||||||
|
# mimetype="application/json")
|
||||||
|
#
|
||||||
|
# db.put(course)
|
||||||
|
# db.save
|
||||||
|
# return Response(response=json.dumps(course.to_JSON()),
|
||||||
|
# status=200,
|
||||||
|
# mimetype="application/json")
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
@app.route('/api/Campuses/<string:token>', methods=['GET'])
|
@app.route('/api/Campuses/<string:token>', methods=['GET'])
|
||||||
@auto.doc()
|
@auto.doc()
|
||||||
|
|
Loading…
Reference in a new issue