Code clean up. Working on returning proper 404 vs 400 responses if the results are empty and nothing went wrong.

This commit is contained in:
Scott Idem
2021-12-13 18:55:31 -05:00
parent 92a44b9f41
commit 39db1999fb
27 changed files with 301 additions and 239 deletions

View File

@@ -154,9 +154,11 @@ async def get_account_obj_activity_log_list(
else:
activity_log_result_list.append(None)
response_data = activity_log_result_list
elif isinstance(activity_log_rec_list_result, list):
elif isinstance(activity_log_rec_list_result, list) or activity_log_rec_list_result is None: # Empty list or None
log.info('No results')
return mk_resp(data=False, status_code=404, response=response) # Not Found
else:
log.warning('Likely bad request')
return mk_resp(data=False, status_code=400, response=response) # Bad Request
return mk_resp(data=response_data, response=response)