Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement user addition in UserService online_chat.py #824

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion solutions/object_oriented_design/online_chat/online_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ def __init__(self):
self.users_by_id = {} # key: user id, value: User

def add_user(self, user_id, name, pass_hash):
pass
if user_id not in self.users_by_id:
new_user = User(user_id, name, pass_hash)
self.users_by_id[user_id] = new_user
return new_user
else:
# User with this ID already exists
return None

def remove_user(self, user_id):
pass
Expand Down