default username to service_id to ensure we have one otherwise a blank string is not a unique username

This commit is contained in:
jasquat 2022-08-29 10:12:06 -04:00
parent 31f403207d
commit 3790a15465
1 changed files with 5 additions and 9 deletions

View File

@ -19,9 +19,9 @@ class UserService:
self,
service: str,
service_id: str,
name: Optional[str] = None,
username: Optional[str] = None,
email: Optional[str] = None,
name: Optional[str] = "",
username: Optional[str] = "",
email: Optional[str] = "",
) -> UserModel:
"""Create_user."""
user_model: Optional[UserModel] = (
@ -30,12 +30,8 @@ class UserService:
.first()
)
if user_model is None:
if name is None:
name = ""
if username is None:
username = ""
if email is None:
email = ""
if username == "":
username = service_id
user_model = UserModel(
username=username,