From 3790a154657d7ee432d70bdd1fae023c5fece95a Mon Sep 17 00:00:00 2001 From: jasquat Date: Mon, 29 Aug 2022 10:12:06 -0400 Subject: [PATCH] default username to service_id to ensure we have one otherwise a blank string is not a unique username --- src/spiffworkflow_backend/services/user_service.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/spiffworkflow_backend/services/user_service.py b/src/spiffworkflow_backend/services/user_service.py index d5b301f0..3698554b 100644 --- a/src/spiffworkflow_backend/services/user_service.py +++ b/src/spiffworkflow_backend/services/user_service.py @@ -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,