fix big allowing to add user to project/course/campus more then once
This commit is contained in:
parent
bd224fb7d8
commit
2064e19d2b
3 changed files with 6 additions and 6 deletions
|
@ -126,8 +126,8 @@ def joinCampus(token, campusId):
|
||||||
if campus is None:
|
if campus is None:
|
||||||
return bad_request("No such course")
|
return bad_request("No such course")
|
||||||
|
|
||||||
if user.key().id() in campus.membersId:
|
if str(user.key().id()) in campus.membersId:
|
||||||
return no_content("User is already member in Project")
|
return bad_request("User is already member in Project")
|
||||||
|
|
||||||
campus.membersId.append(str(user.key().id()))
|
campus.membersId.append(str(user.key().id()))
|
||||||
user.courses_id_list.append(str(campus.key().id()))
|
user.courses_id_list.append(str(campus.key().id()))
|
||||||
|
|
|
@ -149,8 +149,8 @@ def joinCourse(token, courseId):
|
||||||
if course is None:
|
if course is None:
|
||||||
return bad_request("No such course")
|
return bad_request("No such course")
|
||||||
|
|
||||||
if user.key().id() in course.membersId:
|
if str(user.key().id()) in course.membersId:
|
||||||
return no_content("User is already member in Project")
|
return bad_request("User is already member in Course")
|
||||||
|
|
||||||
course.membersId.append(str(user.key().id()))
|
course.membersId.append(str(user.key().id()))
|
||||||
user.courses_id_list.append(str(course.key().id()))
|
user.courses_id_list.append(str(course.key().id()))
|
||||||
|
|
|
@ -122,8 +122,8 @@ def joinProject(token, projectId):
|
||||||
if project is None:
|
if project is None:
|
||||||
return bad_request("No such Project")
|
return bad_request("No such Project")
|
||||||
|
|
||||||
if user.key().id() in project.membersId:
|
if str(user.key().id()) in project.membersId:
|
||||||
return no_content("User is already member in Project")
|
return bad_request("User is already member in Project")
|
||||||
|
|
||||||
project.membersId.append(str(user.key().id()))
|
project.membersId.append(str(user.key().id()))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue