General code clean up. More work on event tracking related

This commit is contained in:
Scott Idem
2022-02-15 16:05:29 -05:00
parent 003ffb4adf
commit df6e860620
8 changed files with 208 additions and 111 deletions

View File

@@ -63,7 +63,7 @@ async def post_person_obj(
): pass
else:
log.warning('Likely bad request')
return mk_resp(data=False, status_code=400, response=commons.response, status_message='Something failed while processing the data.') # Bad Request
return mk_resp(data=False, status_code=400, response=commons.response, status_message='Not created. Something failed while processing the data. Check the field names and data types.') # Bad Request
# ### SECTION ### Return successful results
if return_obj:
@@ -132,7 +132,7 @@ async def patch_person_obj(
): pass
else:
log.warning('Likely bad request')
return mk_resp(data=False, status_code=400, response=commons.response, status_message='Something failed while processing the data.') # Bad Request
return mk_resp(data=False, status_code=400, response=commons.response, status_message='Not updated. Something failed while processing the data. Check the field names and data types.') # Bad Request
# ### SECTION ### Return successful results
if return_obj:
@@ -276,10 +276,9 @@ async def lookup_email(
# ### BEGIN ### API Person ### email_create_url() ###
# Updated 2021-12-03
# @router.get('/person/{person_id}/email_create_url', response_model=Resp_Body_Base)
@router.get('/person/{person_id}/email_auth_key_url', response_model=Resp_Body_Base)
async def email_auth_key_url(
person_id: str = Query(None, min_length=11, max_length=22),
person_id: str = Query(..., min_length=11, max_length=22),
root_url: Optional[str] = Query(None, min_length=10, max_length=100), # Absolute min = 7
commons: Common_Route_Params = Depends(common_route_params),
):
@@ -344,6 +343,7 @@ async def get_person_obj(
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
# ### SECTION ### Secondary data validation
if person_id := redis_lookup_id_random(record_id_random=person_id, table_name='person'): pass
else: return mk_resp(data=None, status_code=404, response=commons.response)
@@ -413,7 +413,6 @@ async def get_account_obj_person_list(
else: return mk_resp(data=None, status_code=404, response=commons.response)
response_data = None
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
# Updated 2022-01-17
if person_rec_list_result := get_person_rec_list(