diff --git a/SE_API/ProjectRoutes.py b/SE_API/ProjectRoutes.py index 44c2015..46d35cc 100644 --- a/SE_API/ProjectRoutes.py +++ b/SE_API/ProjectRoutes.py @@ -26,9 +26,9 @@ from SE_API.Respones_Utils import * project_routes = Blueprint("project_routes", __name__) auto = Autodoc() -@project_routes.route('/api/projects/Create//', methods=['POST']) +@project_routes.route('/api/projects/create/', methods=['POST']) @auto.doc() -def create_project(token,id): +def create_project(token): """ This call will create a new project in the DB
@@ -62,7 +62,7 @@ def create_project(token,id): #todo: check legality try: - project = Project(projectName=payload['projectName'], masterId=user.key().id(), gitRepository=payload['gitRepository'], membersId=[token]) + project = Project(projectName=payload['projectName'], courseName=payload['courseName'], masterId=user.key().id(), gitRepository=payload['gitRepository'], membersId=[token]) except Exception as e: print e return bad_request() @@ -77,62 +77,55 @@ def create_project(token,id): -@project_routes.route('/api/projects/getAll/', methods=['GET']) +@project_routes.route('/api/projects/getProjectsByCourseName/', methods=["GET"]) @auto.doc() -def get_projects(token): - """ - This Call will return an array of all projects available +def getProjectsByCourseName(name): + ''' + This Function is will Activate a user and add tha campus to it
Route Parameters
- - seToken: 'seToken' + - validation_token: 'seToken|email_suffix'

Payload
- - NONE
+ - NONE

Response
- 200 - JSON Array, Example:
- [
- { - 'title': 'JCE',
- 'email_ending': '@post.jce.ac.il',
- 'master_user_id': 123453433341, (User that created the campus)
- 'avatar_url': 'http://some.domain.com/imagefile.jpg'
- },
- ....
- {
- ...
- }req
- ]
+ 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']
+ } +

- 403 - Invalid Token
- 500 - Server Error - """ - if is_user_token_valid(token): - arr = [] - query = Campus.all() - for c in query.run(): - arr.append(dict(json.loads(c.to_JSON()))) - print arr - if len(arr) != 0: - return Response(response=json.dumps(arr), - status=200, - mimetype="application/json") - else: - return Response(response=[], - status=200, - mimetype="application/json") + 403 - Invalid Token + ''' + + arr = [] + query = Project.all() + query.filter("courseName = ", name) + + for p in query.run(): + arr.append(dict(json.loads(p.to_JSON()))) + print arr + if len(arr) != 0: + return Response(response=json.dumps(arr), + status=200, + mimetype="application/json") else: - return forbidden("Invalid Token") - - - -@project_routes.route('/api/Projects/', methods=['GET']) -@auto.doc() -def get_campuses(token): - pass + return Response(response=[], + status=200, + mimetype="application/json")