Just lots of work and tweeks
This commit is contained in:
@@ -256,45 +256,45 @@ async def get_event_obj(
|
||||
else: return mk_resp(data=None, status_code=404, response=response)
|
||||
|
||||
if event_obj := load_event_obj(
|
||||
event_id = event_id,
|
||||
enabled = enabled,
|
||||
approved = approved,
|
||||
hidden = hidden,
|
||||
review = review,
|
||||
inc_file_count = inc_file_count,
|
||||
inc_address = inc_address,
|
||||
# inc_address_location = inc_address_location,
|
||||
inc_contact = inc_contact,
|
||||
# inc_event_abstract_list = inc_event_abstract_list,
|
||||
# inc_event_badge_list = inc_event_badge_list,
|
||||
inc_event_cfg = inc_event_cfg,
|
||||
# inc_event_device_list = inc_event_device_list,
|
||||
# inc_event_exhibit_list = inc_event_exhibit_list,
|
||||
inc_event_file_list = inc_event_file_list,
|
||||
inc_event_location = inc_event_location,
|
||||
inc_event_location_list = inc_event_location_list,
|
||||
# inc_event_person = inc_event_person,
|
||||
inc_event_person_list = inc_event_person_list,
|
||||
inc_event_presentation_list = inc_event_presentation_list,
|
||||
inc_event_presenter_cat = inc_event_presenter_cat,
|
||||
inc_event_presenter_list = inc_event_presenter_list,
|
||||
inc_event_registration_cfg = inc_event_registration_cfg,
|
||||
# inc_event_registration_list = inc_event_registration_list,
|
||||
inc_event_session_list = inc_event_session_list,
|
||||
# inc_event_track = inc_event_track,
|
||||
# inc_event_track_list = inc_event_track_list,
|
||||
# inc_order_list = inc_order_list,
|
||||
inc_organization = inc_organization,
|
||||
inc_person = inc_person,
|
||||
inc_poc_event_person = inc_poc_event_person,
|
||||
# inc_product = inc_product,
|
||||
# inc_product_list = inc_product_list,
|
||||
inc_user = inc_user,
|
||||
limit = limit,
|
||||
by_alias = by_alias,
|
||||
exclude_unset = exclude_unset,
|
||||
# model_as_dict = model_as_dict,
|
||||
):
|
||||
event_id = event_id,
|
||||
enabled = enabled,
|
||||
approved = approved,
|
||||
hidden = hidden,
|
||||
review = review,
|
||||
inc_file_count = inc_file_count,
|
||||
inc_address = inc_address,
|
||||
# inc_address_location = inc_address_location,
|
||||
inc_contact = inc_contact,
|
||||
# inc_event_abstract_list = inc_event_abstract_list,
|
||||
# inc_event_badge_list = inc_event_badge_list,
|
||||
inc_event_cfg = inc_event_cfg,
|
||||
# inc_event_device_list = inc_event_device_list,
|
||||
# inc_event_exhibit_list = inc_event_exhibit_list,
|
||||
inc_event_file_list = inc_event_file_list,
|
||||
inc_event_location = inc_event_location,
|
||||
inc_event_location_list = inc_event_location_list,
|
||||
# inc_event_person = inc_event_person,
|
||||
inc_event_person_list = inc_event_person_list,
|
||||
inc_event_presentation_list = inc_event_presentation_list,
|
||||
inc_event_presenter_cat = inc_event_presenter_cat,
|
||||
inc_event_presenter_list = inc_event_presenter_list,
|
||||
inc_event_registration_cfg = inc_event_registration_cfg,
|
||||
# inc_event_registration_list = inc_event_registration_list,
|
||||
inc_event_session_list = inc_event_session_list,
|
||||
# inc_event_track = inc_event_track,
|
||||
# inc_event_track_list = inc_event_track_list,
|
||||
# inc_order_list = inc_order_list,
|
||||
inc_organization = inc_organization,
|
||||
inc_person = inc_person,
|
||||
inc_poc_event_person = inc_poc_event_person,
|
||||
# inc_product = inc_product,
|
||||
# inc_product_list = inc_product_list,
|
||||
inc_user = inc_user,
|
||||
limit = limit,
|
||||
by_alias = by_alias,
|
||||
exclude_unset = exclude_unset,
|
||||
# model_as_dict = model_as_dict,
|
||||
):
|
||||
# event_dict = event_obj.dict(by_alias=by_alias, exclude_unset=exclude_unset)
|
||||
pass
|
||||
else:
|
||||
|
||||
@@ -185,6 +185,7 @@ async def v3_patch_person_obj_exist(
|
||||
else: return mk_resp(data=False, status_code=400, response=response, status_message='The person was not updated. Check the field names and data types.')
|
||||
|
||||
if isinstance(create_update_person_obj_result, int):
|
||||
log.info('Create/Update successful')
|
||||
person_id = create_update_person_obj_result
|
||||
if return_obj:
|
||||
if load_person_obj_result := load_person_obj(
|
||||
@@ -474,10 +475,11 @@ async def email_create_url(
|
||||
|
||||
|
||||
# ### BEGIN ### API Person ### get_person_obj() ###
|
||||
# Working well as of 2021-06-25. Using as a template for other routes.
|
||||
# Updated 2021-12-15
|
||||
@router.get('/person/{person_id}', response_model=Resp_Body_Base)
|
||||
async def get_person_obj(
|
||||
person_id: str = Query(..., min_length=1, max_length=22),
|
||||
person_id: str = Query(..., min_length=11, max_length=22),
|
||||
auth_key: str = Query(None, min_length=11, max_length=22), # If passed, it must match in the person record. New 2021-12-15
|
||||
limit: int = 500, # For now this covers any included objects or object lists
|
||||
enabled: str = 'enabled', # For now this covers any included objects or object lists
|
||||
inc_address: bool = False, # Priority l1
|
||||
@@ -512,50 +514,60 @@ async def get_person_obj(
|
||||
exclude_unset: Optional[bool] = True,
|
||||
response: Response = Response,
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
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=response)
|
||||
|
||||
if person_dict := load_person_obj(
|
||||
person_id = person_id,
|
||||
limit = limit,
|
||||
exclude_unset = False,
|
||||
model_as_dict = False, # NOTE: returning model as a dict
|
||||
enabled = enabled,
|
||||
inc_address = inc_address,
|
||||
# inc_archive_list = inc_archive_list,
|
||||
inc_contact = inc_contact,
|
||||
inc_event_list = inc_event_list,
|
||||
# inc_hosted_file_list = inc_hosted_file_list,
|
||||
inc_journal_list = inc_journal_list,
|
||||
# inc_journal_entry_list = inc_journal_entry_list,
|
||||
inc_membership_group_list = inc_membership_group_list,
|
||||
inc_membership_group_person_list = inc_membership_group_person_list,
|
||||
inc_membership_person = inc_membership_person,
|
||||
inc_membership_person_profile = inc_membership_person_profile,
|
||||
inc_membership_type = inc_membership_type,
|
||||
inc_membership_type_person = inc_membership_type_person,
|
||||
inc_order_closed_count = inc_order_closed_count,
|
||||
inc_order_line_list = inc_order_line_list,
|
||||
inc_order_list = inc_order_list,
|
||||
inc_order_cart = inc_order_cart,
|
||||
# inc_order_cart_list = inc_order_cart_list,
|
||||
inc_organization = inc_organization,
|
||||
# inc_organization_list = inc_organization_list,
|
||||
inc_post_list = inc_post_list,
|
||||
inc_post_comment_list = inc_post_comment_list,
|
||||
inc_user = inc_user,
|
||||
):
|
||||
if isinstance(person_dict, dict):
|
||||
response_data = person_dict
|
||||
else:
|
||||
response_data = person_dict
|
||||
if person_rec_result := load_person_obj(
|
||||
person_id = person_id,
|
||||
auth_key = auth_key,
|
||||
limit = limit,
|
||||
exclude_unset = False,
|
||||
model_as_dict = False, # NOTE: returning model as a dict
|
||||
enabled = enabled,
|
||||
inc_address = inc_address,
|
||||
# inc_archive_list = inc_archive_list,
|
||||
inc_contact = inc_contact,
|
||||
inc_event_list = inc_event_list,
|
||||
# inc_hosted_file_list = inc_hosted_file_list,
|
||||
inc_journal_list = inc_journal_list,
|
||||
# inc_journal_entry_list = inc_journal_entry_list,
|
||||
inc_membership_group_list = inc_membership_group_list,
|
||||
inc_membership_group_person_list = inc_membership_group_person_list,
|
||||
inc_membership_person = inc_membership_person,
|
||||
inc_membership_person_profile = inc_membership_person_profile,
|
||||
inc_membership_type = inc_membership_type,
|
||||
inc_membership_type_person = inc_membership_type_person,
|
||||
inc_order_closed_count = inc_order_closed_count,
|
||||
inc_order_line_list = inc_order_line_list,
|
||||
inc_order_list = inc_order_list,
|
||||
inc_order_cart = inc_order_cart,
|
||||
# inc_order_cart_list = inc_order_cart_list,
|
||||
inc_organization = inc_organization,
|
||||
# inc_organization_list = inc_organization_list,
|
||||
inc_post_list = inc_post_list,
|
||||
inc_post_comment_list = inc_post_comment_list,
|
||||
inc_user = inc_user,
|
||||
):
|
||||
response_data = person_rec_result
|
||||
# if isinstance(person_rec_result, dict):
|
||||
# response_data = person_rec_result
|
||||
# else:
|
||||
# response_data = person_rec_result
|
||||
# else:
|
||||
# return mk_resp(data=False, status_code=400, response=response) # Bad Request
|
||||
|
||||
elif isinstance(person_rec_result, list) or person_rec_result is None: # Empty list or None
|
||||
log.info('No results')
|
||||
if auth_key: log.info('It is likely the auth_key did not match.')
|
||||
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)
|
||||
return mk_resp(data=response_data, response=response)
|
||||
# ### END ### API Person ### get_person_obj() ###
|
||||
|
||||
|
||||
@@ -620,7 +632,7 @@ async def get_account_obj_person_list(
|
||||
else:
|
||||
return mk_resp(data=False, status_code=400, response=response) # Bad Request
|
||||
|
||||
return mk_resp(data=response_data)
|
||||
return mk_resp(data=response_data, response=response)
|
||||
# ### END ### API Person ### get_account_obj_person_list() ###
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user