Code clean up. Bug fixes for person, user, contact, and address methods. There is a bug related get_account_id_w_for_type_id()

This commit is contained in:
Scott Idem
2022-01-06 18:34:53 -05:00
parent 597c765673
commit 29c6770581
4 changed files with 94 additions and 15 deletions

View File

@@ -63,6 +63,10 @@ def create_user_obj(
user_dict = user_obj.dict(by_alias=False, exclude_defaults=False, exclude_unset=True, exclude={'contact', 'contact_id_random', 'new_password', 'organization', 'person', 'person_id_random', 'created_on', 'updated_on'})
# ### SECTION ### Process data
# Look for an account_id in the user_obj
if account_id: pass
elif account_id := user_obj.account_id: pass
user_obj.account_id = account_id # Is this needed?
user_dict['account_id'] = account_id
@@ -78,6 +82,10 @@ def create_user_obj(
# user_dict['password'] = user_obj.password # There has to be a better way to do this??? It thinks "password" is unset and so is excluded?
# Look for a person_id in the user_obj
if person_id: pass
elif person_id := user_obj.person.id: pass
if person_id:
# Link to an existing person
log.info(f'Adding person_id to user_dict. User ID: {person_id}')
@@ -301,6 +309,10 @@ def update_user_obj(
log.debug(user_obj.new_password)
# Look for a person_id in the user_obj
if person_id: pass
elif person_id := user_obj.person.id: pass
if person_id:
# Link to an existing person
log.info(f'Adding person_id to person_dict. Person ID: {person_id}')