Code clean up. Simplifying person, user, contact, and address methods

This commit is contained in:
Scott Idem
2022-01-06 13:47:23 -05:00
parent 567f6a6302
commit c01e668d9e
5 changed files with 22 additions and 21 deletions

View File

@@ -223,11 +223,12 @@ async def user_authenticate(
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
if account_id and username and password:
account_id = commons.x_account_id
account_id = commons.x_account_id
if username and password:
user_data = {}
user_data['account_id'] = account_id
if not null_account_id: user_data['account_id'] = account_id
else: user_data['account_id'] = None
user_data['username'] = username
# sql_select(table_name='user', data=user_data)
@@ -631,14 +632,14 @@ async def lookup_email(
data['account_id'] = account_id
data['email'] = email
if enabled in ['enabled', 'disabled', 'all']:
if enabled == 'enabled':
if commons.enabled in ['enabled', 'disabled', 'all']:
if commons.enabled == 'enabled':
data['enable'] = True
sql_enabled = f'AND `user`.enable = :enable'
elif enabled == 'disabled':
elif commons.enabled == 'disabled':
data['enable'] = False
sql_enabled = f'AND `user`.enable = :enable'
elif enabled == 'all':
elif commons.enabled == 'all':
sql_enabled = ''
else:
return mk_resp(data=None, status_code=400, response=commons.response) # Bad Request