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:
|
||||
return bad_request("No such course")
|
||||
|
||||
if user.key().id() in campus.membersId:
|
||||
return no_content("User is already member in Project")
|
||||
if str(user.key().id()) in campus.membersId:
|
||||
return bad_request("User is already member in Project")
|
||||
|
||||
campus.membersId.append(str(user.key().id()))
|
||||
user.courses_id_list.append(str(campus.key().id()))
|
||||
|
|
|
@ -149,8 +149,8 @@ def joinCourse(token, courseId):
|
|||
if course is None:
|
||||
return bad_request("No such course")
|
||||
|
||||
if user.key().id() in course.membersId:
|
||||
return no_content("User is already member in Project")
|
||||
if str(user.key().id()) in course.membersId:
|
||||
return bad_request("User is already member in Course")
|
||||
|
||||
course.membersId.append(str(user.key().id()))
|
||||
user.courses_id_list.append(str(course.key().id()))
|
||||
|
|
|
@ -122,8 +122,8 @@ def joinProject(token, projectId):
|
|||
if project is None:
|
||||
return bad_request("No such Project")
|
||||
|
||||
if user.key().id() in project.membersId:
|
||||
return no_content("User is already member in Project")
|
||||
if str(user.key().id()) in project.membersId:
|
||||
return bad_request("User is already member in Project")
|
||||
|
||||
project.membersId.append(str(user.key().id()))
|
||||
|
||||
|
|
Loading…
Reference in a new issue