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