Skip to content

Commit

Permalink
return empty user
Browse files Browse the repository at this point in the history
  • Loading branch information
Adibuer-lab committed Jun 27, 2024
1 parent e222c51 commit 7aa9962
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/users/src/users_service/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def get_user_by_username(username: str) -> Optional[User]:
KeyConditionExpression=Key('username').eq(username)
)
items = response.get('Items', [])
return User.from_dict(items[0])
return User.from_dict(items[0]) if items else User()
except ClientError as e:
current_app.logger.error(f"Error getting user by username: {str(e)}")
return None
Expand All @@ -215,7 +215,7 @@ def get_user_by_identity_id(identity_id: str) -> Optional[User]:
KeyConditionExpression=Key('identity_id').eq(identity_id)
)
items = response.get('Items', [])
return User.from_dict(items[0])
return User.from_dict(items[0]) if items else User()
except ClientError as e:
current_app.logger.error(f"Error getting user by identity_id: {str(e)}")
return None
Expand Down

0 comments on commit 7aa9962

Please sign in to comment.