Work on person methods and related
This commit is contained in:
@@ -13,13 +13,14 @@ from app.methods.event_badge_methods import load_event_badge_obj
|
|||||||
# from app.methods.event_file_methods import load_event_file_obj
|
# from app.methods.event_file_methods import load_event_file_obj
|
||||||
from app.methods.event_person_profile_methods import load_event_person_profile_obj
|
from app.methods.event_person_profile_methods import load_event_person_profile_obj
|
||||||
# from app.methods.event_presentation_methods import load_event_presentation_obj
|
# from app.methods.event_presentation_methods import load_event_presentation_obj
|
||||||
# from app.methods.event_presenter_methods import load_event_presenter_obj
|
# from app.methods.event_presenter_methods import get_event_presenter_rec_list, load_event_presenter_obj
|
||||||
# from app.methods.event_registration_methods import create_event_registration_obj, load_event_registration_obj, update_event_registration_obj_v3
|
# from app.methods.event_registration_methods import create_event_registration_obj, load_event_registration_obj, update_event_registration_obj_v3
|
||||||
# from app.methods.event_session_methods import load_event_session_obj
|
# from app.methods.event_session_methods import load_event_session_obj
|
||||||
# from app.methods.event_track_methods import load_event_track_obj
|
# from app.methods.event_track_methods import load_event_track_obj
|
||||||
from app.methods.person_methods import create_person_obj_v3, load_person_obj, update_person_obj
|
from app.methods.person_methods import create_person_obj_v3, load_person_obj, update_person_obj
|
||||||
from app.methods.user_methods import create_user_obj, load_user_obj, update_user_obj
|
from app.methods.user_methods import create_user_obj, load_user_obj, update_user_obj
|
||||||
|
|
||||||
|
from app.models.common_field_schema import default_num_bytes
|
||||||
from app.models.event_person_models import Event_Person_New_Base, Event_Person_Base
|
from app.models.event_person_models import Event_Person_New_Base, Event_Person_Base
|
||||||
|
|
||||||
|
|
||||||
@@ -108,7 +109,39 @@ def load_event_person_obj(
|
|||||||
event_person_obj.event_person_profile = None
|
event_person_obj.event_person_profile = None
|
||||||
|
|
||||||
if inc_event_presentation_list: pass
|
if inc_event_presentation_list: pass
|
||||||
if inc_event_presenter_list: pass
|
|
||||||
|
if inc_event_presenter_list:
|
||||||
|
log.info('Need to include event presenter list...')
|
||||||
|
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
|
from app.methods.event_presenter_methods import get_event_presenter_rec_list, load_event_presenter_obj
|
||||||
|
if event_presenter_rec_list_result := get_event_presenter_rec_list(
|
||||||
|
event_person_id = event_person_id,
|
||||||
|
# event_presentation_id = event_presentation_id,
|
||||||
|
enabled = enabled,
|
||||||
|
limit = limit,
|
||||||
|
):
|
||||||
|
event_presenter_result_list = []
|
||||||
|
for event_presenter_rec in event_presenter_rec_list_result:
|
||||||
|
if load_event_presenter_result := load_event_presenter_obj(
|
||||||
|
event_presenter_id = event_presenter_rec.get('event_presenter_id', None),
|
||||||
|
enabled = enabled,
|
||||||
|
limit = limit,
|
||||||
|
inc_event_file_list = inc_event_file_list,
|
||||||
|
inc_event_person = False,
|
||||||
|
by_alias = by_alias,
|
||||||
|
exclude_unset = exclude_unset,
|
||||||
|
# model_as_dict = model_as_dict,
|
||||||
|
):
|
||||||
|
event_presenter_result_list.append(load_event_presenter_result)
|
||||||
|
else:
|
||||||
|
event_presenter_result_list.append(None)
|
||||||
|
log.debug(event_presenter_result_list)
|
||||||
|
event_person_obj.event_presenter_list = event_presenter_result_list
|
||||||
|
elif isinstance(event_presenter_rec_list_result, list):
|
||||||
|
event_person_obj.event_presenter_list = []
|
||||||
|
else:
|
||||||
|
event_person_obj.event_presenter_list = None
|
||||||
|
|
||||||
if inc_event_registration: pass
|
if inc_event_registration: pass
|
||||||
if inc_event_session_list: pass
|
if inc_event_session_list: pass
|
||||||
if inc_event_track_list: pass
|
if inc_event_track_list: pass
|
||||||
@@ -270,9 +303,9 @@ def get_event_id_w_event_person_id(
|
|||||||
# Rewrite and updated 2021-08-25
|
# Rewrite and updated 2021-08-25
|
||||||
def create_update_event_person_obj_v4(
|
def create_update_event_person_obj_v4(
|
||||||
event_person_dict_obj: Event_Person_Base|dict,
|
event_person_dict_obj: Event_Person_Base|dict,
|
||||||
event_person_id: int|str = None,
|
event_person_id: int|str|None = None,
|
||||||
account_id: int|str = None,
|
account_id: int|str|None = None,
|
||||||
event_id: int|str = None,
|
event_id: int|str|None = None,
|
||||||
create_sub_obj: bool = False,
|
create_sub_obj: bool = False,
|
||||||
fail_any: bool = False, # Fail if any thing goes wrong for sub objects
|
fail_any: bool = False, # Fail if any thing goes wrong for sub objects
|
||||||
return_outline: bool = False,
|
return_outline: bool = False,
|
||||||
@@ -299,7 +332,7 @@ def create_update_event_person_obj_v4(
|
|||||||
if event_id := get_event_id_w_for_type_id(for_type='event_person', for_id=event_person_id): pass
|
if event_id := get_event_id_w_for_type_id(for_type='event_person', for_id=event_person_id): pass
|
||||||
else:
|
else:
|
||||||
log.error('Unable to get Event ID from related object.')
|
log.error('Unable to get Event ID from related object.')
|
||||||
False
|
# return False
|
||||||
|
|
||||||
if account_id := redis_lookup_id_random(record_id_random=account_id, table_name='account'): pass
|
if account_id := redis_lookup_id_random(record_id_random=account_id, table_name='account'): pass
|
||||||
else:
|
else:
|
||||||
@@ -311,7 +344,7 @@ def create_update_event_person_obj_v4(
|
|||||||
elif account_id := get_account_id_w_for_type_id(for_type='event_person', for_id=event_person_id): pass
|
elif account_id := get_account_id_w_for_type_id(for_type='event_person', for_id=event_person_id): pass
|
||||||
else:
|
else:
|
||||||
log.error('Unable to get Account ID from related object.')
|
log.error('Unable to get Account ID from related object.')
|
||||||
False
|
# return False
|
||||||
else:
|
else:
|
||||||
log.info('No Event Person ID passed. Create new Event Person. Required: Account ID, Event ID')
|
log.info('No Event Person ID passed. Create new Event Person. Required: Account ID, Event ID')
|
||||||
|
|
||||||
@@ -330,7 +363,7 @@ def create_update_event_person_obj_v4(
|
|||||||
if account_id := get_account_id_w_for_type_id(for_type='event', for_id=event_id): pass
|
if account_id := get_account_id_w_for_type_id(for_type='event', for_id=event_id): pass
|
||||||
else:
|
else:
|
||||||
log.error('Unable to get Account ID from related object.')
|
log.error('Unable to get Account ID from related object.')
|
||||||
False
|
return False
|
||||||
|
|
||||||
log.debug(type(event_person_dict_obj))
|
log.debug(type(event_person_dict_obj))
|
||||||
if isinstance(event_person_dict_obj, dict):
|
if isinstance(event_person_dict_obj, dict):
|
||||||
@@ -368,7 +401,7 @@ def create_update_event_person_obj_v4(
|
|||||||
return False
|
return False
|
||||||
log.debug(event_person_dict_up_result)
|
log.debug(event_person_dict_up_result)
|
||||||
else:
|
else:
|
||||||
if event_person_dict_in_result := sql_insert(data=event_person_dict, table_name='event_person', rm_id_random=True, id_random_length=8): pass
|
if event_person_dict_in_result := sql_insert(data=event_person_dict, table_name='event_person', rm_id_random=True, id_random_length=default_num_bytes): pass
|
||||||
else:
|
else:
|
||||||
log.warning(f'Event Person not created.')
|
log.warning(f'Event Person not created.')
|
||||||
log.debug(event_person_dict_in_result)
|
log.debug(event_person_dict_in_result)
|
||||||
@@ -408,6 +441,34 @@ def create_update_event_person_obj_v4(
|
|||||||
|
|
||||||
# event_person_outline['event_badge_id'] = event_badge_id
|
# event_person_outline['event_badge_id'] = event_badge_id
|
||||||
|
|
||||||
|
# NOTE: WARNING: This has not been fully tested yet. 2021-09-07
|
||||||
|
# NOTE: Use object model version because of better type checking and validations
|
||||||
|
if event_person_obj.event_person_profile:
|
||||||
|
event_person_outline['event_person_profile_id'] = None
|
||||||
|
event_person_profile_obj = event_person_obj.event_person_profile
|
||||||
|
if event_person_profile_id := event_person_obj.event_person_profile_id: pass
|
||||||
|
elif event_person_profile_id := event_person_profile_obj.id: pass
|
||||||
|
else: event_person_profile_id = None
|
||||||
|
# event_person_profile_obj.id
|
||||||
|
event_person_profile_obj.event_person_id = event_person_id
|
||||||
|
create_update_event_person_profile_obj_result = create_update_event_person_profile_obj_v4(
|
||||||
|
event_person_profile_dict_obj = event_person_profile_obj,
|
||||||
|
event_person_profile_id = event_person_profile_id,
|
||||||
|
account_id = account_id,
|
||||||
|
event_id = event_id,
|
||||||
|
event_person_id = event_person_id,
|
||||||
|
fail_any = fail_any,
|
||||||
|
return_outline = return_outline,
|
||||||
|
)
|
||||||
|
if isinstance(create_update_event_person_profile_obj_result, int):
|
||||||
|
event_person_profile_id = create_update_event_person_profile_obj_result
|
||||||
|
elif create_update_event_person_profile_obj_result == True: pass
|
||||||
|
else:
|
||||||
|
log.warning(f'Create or Update failed while trying create_update_event_person_profile_obj_v4(): {create_update_event_person_profile_obj_result}')
|
||||||
|
event_person_profile_id = None
|
||||||
|
|
||||||
|
event_person_outline['event_person_profile_id'] = event_person_profile_id
|
||||||
|
|
||||||
if return_outline:
|
if return_outline:
|
||||||
log.debug(f'Returning the Event Person Outline: {event_person_outline}')
|
log.debug(f'Returning the Event Person Outline: {event_person_outline}')
|
||||||
return event_person_outline
|
return event_person_outline
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ def get_event_person_id_w_event_person_profile_id(
|
|||||||
# NOTE: This will create or update a event_person_profile.
|
# NOTE: This will create or update a event_person_profile.
|
||||||
# Rewrite and updated 2021-09-07
|
# Rewrite and updated 2021-09-07
|
||||||
def create_update_event_person_profile_obj_v4(
|
def create_update_event_person_profile_obj_v4(
|
||||||
event_person_profile_dict_obj: Event_Person_Profile|dict,
|
event_person_profile_dict_obj: Event_Person_Profile_Base|dict,
|
||||||
event_person_profile_id: int|str = None,
|
event_person_profile_id: int|str = None,
|
||||||
account_id: int|str = None,
|
account_id: int|str = None,
|
||||||
event_id: int|str = None,
|
event_id: int|str = None,
|
||||||
@@ -137,7 +137,7 @@ def create_update_event_person_profile_obj_v4(
|
|||||||
if event_person_profile_id:
|
if event_person_profile_id:
|
||||||
event_person_profile_dict['event_person_profile_id'] = event_person_profile_id
|
event_person_profile_dict['event_person_profile_id'] = event_person_profile_id
|
||||||
try:
|
try:
|
||||||
event_person_profile_obj = Event_Person_Profile(**event_person_profile_dict)
|
event_person_profile_obj = Event_Person_Profile_Base(**event_person_profile_dict)
|
||||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
log.debug(event_person_profile_obj)
|
log.debug(event_person_profile_obj)
|
||||||
except ValidationError as e:
|
except ValidationError as e:
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ def load_event_presentation_obj(
|
|||||||
inc_event_device_list: bool = False,
|
inc_event_device_list: bool = False,
|
||||||
inc_event_file_list: bool = False,
|
inc_event_file_list: bool = False,
|
||||||
inc_event_person: bool = False,
|
inc_event_person: bool = False,
|
||||||
|
inc_event_person_profile: bool = False,
|
||||||
inc_event_person_list: bool = False,
|
inc_event_person_list: bool = False,
|
||||||
inc_event_presenter_list: bool = False,
|
inc_event_presenter_list: bool = False,
|
||||||
inc_event_registration: bool = False,
|
inc_event_registration: bool = False,
|
||||||
@@ -112,18 +113,19 @@ def load_event_presentation_obj(
|
|||||||
for event_presenter_obj in event_presenter_obj_li_result:
|
for event_presenter_obj in event_presenter_obj_li_result:
|
||||||
event_presenter_id = event_presenter_obj.get('event_presenter_id', None)
|
event_presenter_id = event_presenter_obj.get('event_presenter_id', None)
|
||||||
if event_presenter_obj := load_event_presenter_obj(
|
if event_presenter_obj := load_event_presenter_obj(
|
||||||
event_presenter_id=event_presenter_id,
|
event_presenter_id = event_presenter_id,
|
||||||
enabled=enabled,
|
enabled = enabled,
|
||||||
inc_address=inc_address,
|
inc_address = inc_address,
|
||||||
inc_contact=inc_contact,
|
inc_contact = inc_contact,
|
||||||
inc_event_abstract_list=inc_event_abstract_list,
|
inc_event_abstract_list = inc_event_abstract_list,
|
||||||
inc_event_badge=inc_event_badge,
|
inc_event_badge = inc_event_badge,
|
||||||
inc_event_device_list=inc_event_device_list,
|
inc_event_device_list = inc_event_device_list,
|
||||||
inc_event_file_list=inc_event_file_list,
|
inc_event_file_list = inc_event_file_list,
|
||||||
inc_event_person=inc_event_person,
|
inc_event_person = inc_event_person,
|
||||||
inc_event_registration=inc_event_registration,
|
inc_event_person_profile = inc_event_person_profile,
|
||||||
inc_person=inc_person,
|
inc_event_registration = inc_event_registration,
|
||||||
inc_user=inc_user,
|
inc_person = inc_person,
|
||||||
|
inc_user = inc_user,
|
||||||
):
|
):
|
||||||
data = event_presenter_obj.dict(by_alias=True, exclude_unset=True)
|
data = event_presenter_obj.dict(by_alias=True, exclude_unset=True)
|
||||||
event_presenter_obj_li.append(data)
|
event_presenter_obj_li.append(data)
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ def load_event_presenter_obj(
|
|||||||
event_presenter_id: int|str,
|
event_presenter_id: int|str,
|
||||||
enabled: str = 'enabled', # enabled, disabled, all
|
enabled: str = 'enabled', # enabled, disabled, all
|
||||||
limit: int = 1000,
|
limit: int = 1000,
|
||||||
|
by_alias: bool = True,
|
||||||
|
exclude_unset: bool = True,
|
||||||
|
model_as_dict: bool = False,
|
||||||
inc_address: bool = False,
|
inc_address: bool = False,
|
||||||
inc_contact: bool = False,
|
inc_contact: bool = False,
|
||||||
inc_event_abstract_list: bool = False, # For event_presenter and using load_event_person_obj
|
inc_event_abstract_list: bool = False, # For event_presenter and using load_event_person_obj
|
||||||
@@ -27,6 +30,7 @@ def load_event_presenter_obj(
|
|||||||
inc_event_device_list: bool = False, # For event_presenter and using load_event_person_obj
|
inc_event_device_list: bool = False, # For event_presenter and using load_event_person_obj
|
||||||
inc_event_file_list: bool = False, # For event_presenter and using load_event_person_obj
|
inc_event_file_list: bool = False, # For event_presenter and using load_event_person_obj
|
||||||
inc_event_person: bool = False, # Using load_event_person_obj
|
inc_event_person: bool = False, # Using load_event_person_obj
|
||||||
|
inc_event_person_profile: bool = False, # Using load_event_person_obj
|
||||||
# inc_event_presentation: bool = False,
|
# inc_event_presentation: bool = False,
|
||||||
inc_event_registration: bool = False, # Using load_event_person_obj
|
inc_event_registration: bool = False, # Using load_event_person_obj
|
||||||
# inc_event_session: bool = False,
|
# inc_event_session: bool = False,
|
||||||
@@ -39,76 +43,148 @@ def load_event_presenter_obj(
|
|||||||
if event_presenter_id := redis_lookup_id_random(record_id_random=event_presenter_id, table_name='event_presenter'): pass
|
if event_presenter_id := redis_lookup_id_random(record_id_random=event_presenter_id, table_name='event_presenter'): pass
|
||||||
else: return False
|
else: return False
|
||||||
|
|
||||||
if event_presenter_rec := sql_select(table_name='v_event_presenter', record_id=event_presenter_id):
|
if event_presenter_rec := sql_select(table_name='v_event_presenter', record_id=event_presenter_id): pass
|
||||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
else: return False
|
||||||
log.debug(event_presenter_rec)
|
|
||||||
|
|
||||||
try:
|
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
event_presenter_obj = Event_Presenter_Base(**event_presenter_rec)
|
log.debug(event_presenter_rec)
|
||||||
log.debug(event_presenter_obj)
|
|
||||||
except ValidationError as e:
|
|
||||||
log.error(e.json())
|
|
||||||
return False
|
|
||||||
|
|
||||||
# event_presenter_obj = Event_Presenter_Base(**event_presenter_rec)
|
try:
|
||||||
# log.debug(event_presenter_obj)
|
log.info('Try to apply event presenter record data to Event_Presenter_Base...')
|
||||||
|
event_presenter_obj = Event_Presenter_Base(**event_presenter_rec)
|
||||||
#account_id = event_presenter_rec.get('account_id', None)
|
log.debug(event_presenter_obj)
|
||||||
event_id = event_presenter_rec.get('event_id', None)
|
except ValidationError as e:
|
||||||
event_abstract_id = event_presenter_rec.get('event_abstract_id', None)
|
log.error(e.json())
|
||||||
event_person_id = event_presenter_rec.get('event_person_id', None)
|
|
||||||
event_presentation_id = event_presenter_rec.get('event_presentation_id', None)
|
|
||||||
event_session_id = event_presenter_rec.get('event_session_id', None)
|
|
||||||
person_id = event_presenter_rec.get('person_id', None)
|
|
||||||
user_id = event_presenter_rec.get('user_id', None)
|
|
||||||
|
|
||||||
# if inc_event: pass
|
|
||||||
if inc_event_abstract_list: pass
|
|
||||||
if inc_event_device_list: pass
|
|
||||||
if inc_event_file_list: pass
|
|
||||||
|
|
||||||
if inc_event_person:
|
|
||||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
|
||||||
|
|
||||||
if event_person_obj := load_event_person_obj(
|
|
||||||
event_person_id=event_person_id,
|
|
||||||
enabled=enabled,
|
|
||||||
inc_address=inc_address,
|
|
||||||
inc_contact=inc_contact,
|
|
||||||
inc_event_badge=inc_event_badge,
|
|
||||||
inc_event_registration=inc_event_registration,
|
|
||||||
inc_person=inc_person,
|
|
||||||
inc_user=inc_user,
|
|
||||||
):
|
|
||||||
log.debug(event_person_obj)
|
|
||||||
event_presenter_obj.event_person = event_person_obj
|
|
||||||
else:
|
|
||||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
|
||||||
log.debug(event_person_obj)
|
|
||||||
event_presenter_obj.event_person = None
|
|
||||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
|
||||||
|
|
||||||
# if inc_person:
|
|
||||||
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
|
||||||
|
|
||||||
# if person_obj := load_person_obj(
|
|
||||||
# person_id=person_id,
|
|
||||||
# enabled=enabled
|
|
||||||
# ):
|
|
||||||
# log.debug(person_obj)
|
|
||||||
# presenter_obj.person = person_obj
|
|
||||||
# else:
|
|
||||||
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
|
||||||
# log.debug(person_obj)
|
|
||||||
# log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
|
||||||
# if inc_user: pass
|
|
||||||
else:
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return event_presenter_obj
|
# event_presenter_obj = Event_Presenter_Base(**event_presenter_rec)
|
||||||
|
# log.debug(event_presenter_obj)
|
||||||
|
|
||||||
|
# account_id = event_presenter_rec.get('account_id', None)
|
||||||
|
event_id = event_presenter_rec.get('event_id', None)
|
||||||
|
event_abstract_id = event_presenter_rec.get('event_abstract_id', None)
|
||||||
|
event_person_id = event_presenter_rec.get('event_person_id', None)
|
||||||
|
event_presentation_id = event_presenter_rec.get('event_presentation_id', None)
|
||||||
|
event_session_id = event_presenter_rec.get('event_session_id', None)
|
||||||
|
person_id = event_presenter_rec.get('person_id', None)
|
||||||
|
user_id = event_presenter_rec.get('user_id', None)
|
||||||
|
|
||||||
|
# if inc_event: pass
|
||||||
|
if inc_event_abstract_list: pass
|
||||||
|
if inc_event_device_list: pass
|
||||||
|
if inc_event_file_list: pass
|
||||||
|
|
||||||
|
if inc_event_person:
|
||||||
|
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
|
|
||||||
|
if event_person_obj := load_event_person_obj(
|
||||||
|
event_person_id = event_person_id,
|
||||||
|
enabled = enabled,
|
||||||
|
inc_address = inc_address,
|
||||||
|
inc_contact = inc_contact,
|
||||||
|
inc_event_badge = inc_event_badge,
|
||||||
|
inc_event_person_profile = inc_event_person_profile,
|
||||||
|
inc_event_registration = inc_event_registration,
|
||||||
|
inc_person = inc_person,
|
||||||
|
inc_user = inc_user,
|
||||||
|
):
|
||||||
|
log.debug(event_person_obj)
|
||||||
|
event_presenter_obj.event_person = event_person_obj
|
||||||
|
else:
|
||||||
|
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
|
log.debug(event_person_obj)
|
||||||
|
event_presenter_obj.event_person = None
|
||||||
|
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
|
|
||||||
|
# if inc_person:
|
||||||
|
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
|
|
||||||
|
# if person_obj := load_person_obj(
|
||||||
|
# person_id=person_id,
|
||||||
|
# enabled=enabled
|
||||||
|
# ):
|
||||||
|
# log.debug(person_obj)
|
||||||
|
# presenter_obj.person = person_obj
|
||||||
|
# else:
|
||||||
|
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
|
# log.debug(person_obj)
|
||||||
|
# log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
|
# if inc_user: pass
|
||||||
|
|
||||||
|
if model_as_dict:
|
||||||
|
return event_presenter_obj.dict(by_alias=by_alias, exclude_unset=exclude_unset) # pylint: disable=no-member
|
||||||
|
else:
|
||||||
|
return event_presenter_obj
|
||||||
# ### END ### API Event Presenter Methods ### load_event_presenter_obj() ###
|
# ### END ### API Event Presenter Methods ### load_event_presenter_obj() ###
|
||||||
|
|
||||||
|
|
||||||
|
# ### BEGIN ### API Event Presenter Methods ### get_event_presenter_rec_list() ###
|
||||||
|
def get_event_presenter_rec_list(
|
||||||
|
event_person_id: str = None,
|
||||||
|
event_presentation_id: str = None,
|
||||||
|
enabled: str = 'enabled', # enabled, disabled, all
|
||||||
|
limit: int = 100,
|
||||||
|
) -> list|bool:
|
||||||
|
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
|
log.debug(locals())
|
||||||
|
|
||||||
|
if event_person_id := redis_lookup_id_random(record_id_random=event_person_id, table_name='event_person'): pass
|
||||||
|
else: return False
|
||||||
|
|
||||||
|
data = {}
|
||||||
|
data[f'event_person_id'] = event_person_id
|
||||||
|
data[f'event_presentation_id'] = event_presentation_id
|
||||||
|
|
||||||
|
if event_person_id:
|
||||||
|
sql_where_event_person_id = f'`event_presenter`.event_person_id = :event_person_id'
|
||||||
|
else: sql_where_event_person_id = ''
|
||||||
|
if event_presentation_id:
|
||||||
|
sql_where_event_presentation_id = f'`event_presenter`.event_presentation_id = :event_presentation_id'
|
||||||
|
else: sql_where_event_presentation_id = ''
|
||||||
|
|
||||||
|
if enabled in ['enabled', 'disabled', 'all']:
|
||||||
|
if enabled == 'enabled':
|
||||||
|
data['enable'] = True
|
||||||
|
sql_enabled = f'AND `event_presenter`.enable = :enable'
|
||||||
|
elif enabled == 'disabled':
|
||||||
|
data['enable'] = False
|
||||||
|
sql_enabled = f'AND `event_presenter`.enable = :enable'
|
||||||
|
elif enabled == 'all':
|
||||||
|
sql_enabled = ''
|
||||||
|
|
||||||
|
if limit:
|
||||||
|
data['limit'] = limit
|
||||||
|
sql_limit = f'LIMIT :limit'
|
||||||
|
else:
|
||||||
|
sql_limit = ''
|
||||||
|
|
||||||
|
sql = f"""
|
||||||
|
SELECT `event_presenter`.id AS 'event_presenter_id', `event_presenter`.id_random AS 'event_presenter_id_random'
|
||||||
|
FROM `event_presenter` AS `event_presenter`
|
||||||
|
WHERE
|
||||||
|
{sql_where_event_person_id}
|
||||||
|
{sql_where_event_presentation_id}
|
||||||
|
{sql_enabled}
|
||||||
|
ORDER BY `event_presenter`.created_on DESC, `event_presenter`.updated_on DESC
|
||||||
|
{sql_limit};
|
||||||
|
"""
|
||||||
|
|
||||||
|
if event_presenter_rec_li_result := sql_select(data=data, sql=sql, as_list=True):
|
||||||
|
|
||||||
|
event_presenter_rec_li = event_presenter_rec_li_result
|
||||||
|
else:
|
||||||
|
event_presenter_rec_li = []
|
||||||
|
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
|
log.debug(event_presenter_rec_li_result)
|
||||||
|
log.debug(type(event_presenter_rec_li))
|
||||||
|
log.debug(len(event_presenter_rec_li))
|
||||||
|
|
||||||
|
return event_presenter_rec_li
|
||||||
|
# ### END ### API Event Presenter Methods ### get_event_presenter_rec_list() ###
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ### BEGIN ### API Event Presenter Methods ### get_event_session_id_w_event_presentation_id() ###
|
# ### BEGIN ### API Event Presenter Methods ### get_event_session_id_w_event_presentation_id() ###
|
||||||
# Updated 2021-08-23
|
# Updated 2021-08-23
|
||||||
def get_event_session_id_w_event_presentation_id(
|
def get_event_session_id_w_event_presentation_id(
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ def load_event_registration_obj(
|
|||||||
if event_registration_rec := sql_select(table_name='v_event_registration', record_id=event_registration_id): pass
|
if event_registration_rec := sql_select(table_name='v_event_registration', record_id=event_registration_id): pass
|
||||||
else: return False
|
else: return False
|
||||||
|
|
||||||
print('******************************** HERE')
|
|
||||||
|
|
||||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
log.debug(event_registration_rec)
|
log.debug(event_registration_rec)
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ def load_event_session_obj(
|
|||||||
inc_event_file_list: bool = False,
|
inc_event_file_list: bool = False,
|
||||||
inc_event_location: bool = False,
|
inc_event_location: bool = False,
|
||||||
inc_event_person: bool = False,
|
inc_event_person: bool = False,
|
||||||
|
inc_event_person_profile: bool = False,
|
||||||
inc_event_person_list: bool = False,
|
inc_event_person_list: bool = False,
|
||||||
inc_event_presentation_list: bool = False,
|
inc_event_presentation_list: bool = False,
|
||||||
inc_event_presenter_cat: bool = False, # Concantinate presenter names
|
inc_event_presenter_cat: bool = False, # Concantinate presenter names
|
||||||
@@ -101,7 +102,8 @@ def load_event_session_obj(
|
|||||||
if inc_event_person_list: pass
|
if inc_event_person_list: pass
|
||||||
|
|
||||||
if inc_event_presentation_list:
|
if inc_event_presentation_list:
|
||||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
|
log.info('Need to include event presentation list...')
|
||||||
|
|
||||||
data = {}
|
data = {}
|
||||||
data['event_session_id'] = event_session_id
|
data['event_session_id'] = event_session_id
|
||||||
@@ -139,18 +141,19 @@ def load_event_session_obj(
|
|||||||
for event_presentation_rec in event_presentation_rec_li_result:
|
for event_presentation_rec in event_presentation_rec_li_result:
|
||||||
event_presentation_id = event_presentation_rec.get('event_presentation_id', None)
|
event_presentation_id = event_presentation_rec.get('event_presentation_id', None)
|
||||||
if event_presentation_obj := load_event_presentation_obj(
|
if event_presentation_obj := load_event_presentation_obj(
|
||||||
event_presentation_id=event_presentation_id,
|
event_presentation_id = event_presentation_id,
|
||||||
enabled=enabled,
|
enabled = enabled,
|
||||||
inc_address=inc_address,
|
inc_address = inc_address,
|
||||||
inc_contact=inc_contact,
|
inc_contact = inc_contact,
|
||||||
inc_event_abstract_list=inc_event_abstract_list,
|
inc_event_abstract_list = inc_event_abstract_list,
|
||||||
inc_event_device_list=inc_event_device_list,
|
inc_event_device_list = inc_event_device_list,
|
||||||
inc_event_file_list=inc_event_file_list,
|
inc_event_file_list = inc_event_file_list,
|
||||||
inc_event_person=inc_event_person,
|
inc_event_person = inc_event_person,
|
||||||
inc_event_person_list=inc_event_person_list,
|
inc_event_person_profile = inc_event_person_profile,
|
||||||
inc_event_presenter_list=inc_event_presenter_list,
|
inc_event_person_list = inc_event_person_list,
|
||||||
inc_person=inc_person,
|
inc_event_presenter_list = inc_event_presenter_list,
|
||||||
inc_user=inc_user
|
inc_person = inc_person,
|
||||||
|
inc_user = inc_user
|
||||||
):
|
):
|
||||||
data = event_presentation_obj.dict(by_alias=True, exclude_unset=True)
|
data = event_presentation_obj.dict(by_alias=True, exclude_unset=True)
|
||||||
event_presentation_obj_li.append(data)
|
event_presentation_obj_li.append(data)
|
||||||
|
|||||||
@@ -448,87 +448,6 @@ def create_person_obj_v3(
|
|||||||
|
|
||||||
person_outline['contact_id'] = contact_id
|
person_outline['contact_id'] = contact_id
|
||||||
|
|
||||||
# NOTE: This is the older pre v4 version
|
|
||||||
# if person_obj_new.contact and isinstance(person_obj_new.contact, dict):
|
|
||||||
# log.info(f'Contact was found. Create a new Contact and link it to the new Person or update existing Contact. Person ID: {person_id}')
|
|
||||||
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
|
||||||
# contact_obj_unknown = person_obj_new.contact
|
|
||||||
# log.debug(contact_obj_unknown)
|
|
||||||
# if contact_id := contact_obj_unknown.get('contact_id_random', None):
|
|
||||||
# log.warning('Contact ID found. This is not expected, but should be ok.')
|
|
||||||
# # from app.methods.contact_methods import update_contact_obj_v3
|
|
||||||
# if update_contact_obj_result := update_contact_obj(
|
|
||||||
# contact_id = contact_id,
|
|
||||||
# contact_obj_up = contact_obj_unknown,
|
|
||||||
# create_sub_obj = create_sub_obj,
|
|
||||||
# fail_any = fail_any,
|
|
||||||
# ):
|
|
||||||
# contact_id = update_contact_obj_result
|
|
||||||
# log.info(f'Contact updated. Contact ID: {contact_id}')
|
|
||||||
# else:
|
|
||||||
# log.warning(f'Contact not updated. Person ID: {person_id}')
|
|
||||||
# log.debug(update_contact_obj_result)
|
|
||||||
# contact_id = None
|
|
||||||
# if fail_any: return False
|
|
||||||
|
|
||||||
# if isinstance(update_contact_obj_result, int):
|
|
||||||
# contact_id = update_contact_obj_result
|
|
||||||
# log.info(f'Contact updated. Contact ID: {contact_id}')
|
|
||||||
# else:
|
|
||||||
# log.warning(f'Contact not updated. Person ID: {person_id}')
|
|
||||||
# log.debug(update_contact_obj_result)
|
|
||||||
# contact_id = None
|
|
||||||
# if fail_any: return False
|
|
||||||
# else:
|
|
||||||
# log.info(f'No Contact ID found.')
|
|
||||||
# # from app.methods.contact_methods import create_contact_obj
|
|
||||||
|
|
||||||
# contact_obj_unknown = person_obj_new.contact
|
|
||||||
# contact_obj_unknown.for_type = 'person'
|
|
||||||
# contact_obj_unknown.for_id = person_id
|
|
||||||
|
|
||||||
# if create_contact_obj_result := create_contact_obj(
|
|
||||||
# account_id = account_id,
|
|
||||||
# for_type = 'person',
|
|
||||||
# for_id = person_id,
|
|
||||||
# contact_obj_new = contact_obj_unknown,
|
|
||||||
# create_sub_obj = create_sub_obj,
|
|
||||||
# fail_any = fail_any,
|
|
||||||
# ):
|
|
||||||
# if isinstance(create_contact_obj_result, int):
|
|
||||||
# contact_id = create_contact_obj_result
|
|
||||||
# log.info(f'Contact created. Contact ID: {contact_id}')
|
|
||||||
# else:
|
|
||||||
# log.warning(f'Contact not created. Person ID: {person_id}')
|
|
||||||
# log.debug(create_contact_obj_result)
|
|
||||||
# contact_id = None
|
|
||||||
# if fail_any: return False
|
|
||||||
# else:
|
|
||||||
# log.warning(f'Contact not created. Person ID: {person_id}')
|
|
||||||
# log.debug(create_contact_obj_result)
|
|
||||||
# contact_id = None
|
|
||||||
# if fail_any: return False
|
|
||||||
# person_outline['contact_id'] = contact_id
|
|
||||||
# else:
|
|
||||||
# log.info('Contact not found or not in a dict.')
|
|
||||||
# pass
|
|
||||||
|
|
||||||
# NOTE: This is the older pre v3 version
|
|
||||||
# if person_obj_new.contact:
|
|
||||||
# log.info(f'Contact was found. Create a new Contact and link it to the new Person or update existing Contact. Person ID: {person_id}')
|
|
||||||
# contact_obj_new = person_obj_new.contact
|
|
||||||
# contact_obj_new.for_type = 'person'
|
|
||||||
# contact_obj_new.for_id = person_id
|
|
||||||
# create_contact_obj_result = create_contact_obj(contact_obj_new=contact_obj_new)
|
|
||||||
# if isinstance(create_contact_obj_result, int):
|
|
||||||
# contact_id = create_contact_obj_result
|
|
||||||
# log.info(f'Contact created. Contact ID: {contact_id}')
|
|
||||||
# else:
|
|
||||||
# log.warning(f'Contact not created. Person ID: {person_id}')
|
|
||||||
# log.debug(create_contact_obj_result)
|
|
||||||
# contact_id = None
|
|
||||||
# if fail_any: return False
|
|
||||||
|
|
||||||
if person_obj_new.organization and isinstance(person_obj_new.organization, dict):
|
if person_obj_new.organization and isinstance(person_obj_new.organization, dict):
|
||||||
log.info(f'Organization was found. Create a new Organization and link it to the new Person or update existing Organization. Person ID: {person_id}')
|
log.info(f'Organization was found. Create a new Organization and link it to the new Person or update existing Organization. Person ID: {person_id}')
|
||||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
@@ -806,77 +725,6 @@ def update_person_obj_v3(
|
|||||||
|
|
||||||
person_outline['contact_id'] = contact_id
|
person_outline['contact_id'] = contact_id
|
||||||
|
|
||||||
# NOTE: This is the older pre v3 version
|
|
||||||
# if person_obj_exist.contact:
|
|
||||||
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
|
||||||
# contact_obj_unknown = person_obj_exist.contact
|
|
||||||
# log.debug(contact_obj_unknown)
|
|
||||||
# if isinstance(person_obj_exist.contact, dict):
|
|
||||||
# contact_id = contact_obj_unknown.get('contact_id_random', None)
|
|
||||||
# # try:
|
|
||||||
# # contact_obj_new = Contact_Base(**contact_obj_new)
|
|
||||||
# # log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
|
||||||
# # log.debug(contact_obj_new)
|
|
||||||
# # except ValidationError as e:
|
|
||||||
# # log.error(e.json())
|
|
||||||
# # return False
|
|
||||||
# else:
|
|
||||||
# contact_id = contact_obj_unknown.id
|
|
||||||
|
|
||||||
# # if contact_id := contact_obj_unknown.get('contact_id_random', None):
|
|
||||||
# if contact_id:
|
|
||||||
# # from app.methods.contact_methods import update_contact_obj_v3
|
|
||||||
# if update_contact_obj_result := update_contact_obj(
|
|
||||||
# contact_id = contact_id,
|
|
||||||
# contact_obj_up = contact_obj_unknown,
|
|
||||||
# create_sub_obj = create_sub_obj,
|
|
||||||
# fail_any = fail_any,
|
|
||||||
# ):
|
|
||||||
# contact_id = update_contact_obj_result
|
|
||||||
# log.info(f'Contact updated. Contact ID: {contact_id}')
|
|
||||||
# else:
|
|
||||||
# log.warning(f'Contact not updated. Person ID: {person_id}')
|
|
||||||
# log.debug(update_contact_obj_result)
|
|
||||||
# contact_id = None
|
|
||||||
# if fail_any: return False
|
|
||||||
|
|
||||||
# if isinstance(update_contact_obj_result, int):
|
|
||||||
# contact_id = update_contact_obj_result
|
|
||||||
# log.info(f'Contact updated. Contact ID: {contact_id}')
|
|
||||||
# else:
|
|
||||||
# log.warning(f'Contact not updated. Person ID: {person_id}')
|
|
||||||
# log.debug(update_contact_obj_result)
|
|
||||||
# contact_id = None
|
|
||||||
# if fail_any: return False
|
|
||||||
# else:
|
|
||||||
# log.info(f'No Contact ID found.')
|
|
||||||
# # from app.methods.contact_methods import create_contact_obj_v3
|
|
||||||
# if create_contact_obj_result := create_contact_obj(
|
|
||||||
# account_id = account_id,
|
|
||||||
# for_type = 'person',
|
|
||||||
# for_id = person_id,
|
|
||||||
# contact_obj_new = contact_obj_unknown,
|
|
||||||
# create_sub_obj = create_sub_obj,
|
|
||||||
# fail_any = fail_any,
|
|
||||||
# ):
|
|
||||||
# if isinstance(create_contact_obj_result, int):
|
|
||||||
# contact_id = create_contact_obj_result
|
|
||||||
# log.info(f'Contact created. Contact ID: {contact_id}')
|
|
||||||
# else:
|
|
||||||
# log.warning(f'Contact not created. Person ID: {person_id}')
|
|
||||||
# log.debug(create_contact_obj_result)
|
|
||||||
# contact_id = None
|
|
||||||
# if fail_any: return False
|
|
||||||
# else:
|
|
||||||
# log.warning(f'Contact not created. Person ID: {person_id}')
|
|
||||||
# log.debug(create_contact_obj_result)
|
|
||||||
# contact_id = None
|
|
||||||
# if fail_any: return False
|
|
||||||
# person_outline['contact_id'] = contact_id
|
|
||||||
# else:
|
|
||||||
# log.info('Contact not found or not in a dict.')
|
|
||||||
# pass
|
|
||||||
|
|
||||||
if person_obj_exist.organization and isinstance(person_obj_exist.organization, dict):
|
if person_obj_exist.organization and isinstance(person_obj_exist.organization, dict):
|
||||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
organization_obj_unknown = person_obj_exist.organization
|
organization_obj_unknown = person_obj_exist.organization
|
||||||
@@ -1158,6 +1006,264 @@ def update_person_obj(
|
|||||||
# ### END ### API Person Methods ### update_person_obj() ###
|
# ### END ### API Person Methods ### update_person_obj() ###
|
||||||
|
|
||||||
|
|
||||||
|
# ### BEGIN ### API Person Methods ### create_update_person_obj_v4b() ###
|
||||||
|
def create_update_person_obj_v4b(
|
||||||
|
account_id: int|str,
|
||||||
|
person_dict_obj: Person_Base,
|
||||||
|
person_id: int|str|None = None,
|
||||||
|
process_contact: bool = True, # For future v5
|
||||||
|
process_organization: bool = True, # For future v5
|
||||||
|
process_user: bool = True, # For future v5
|
||||||
|
create_sub_obj: bool = True, # For future v5
|
||||||
|
fail_any: bool = False, # Fail if any thing goes wrong for sub objects
|
||||||
|
return_outline: bool = False, # For future v5
|
||||||
|
) -> bool:
|
||||||
|
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
|
log.debug(locals())
|
||||||
|
|
||||||
|
log.info('Checking requirements...')
|
||||||
|
if account_id := redis_lookup_id_random(record_id_random=account_id, table_name='account'): log.info(f'Account ID: {account_id}')
|
||||||
|
else:
|
||||||
|
log.error('Missing or invalid Account ID passed. Failed requirement.')
|
||||||
|
log.error(f'Account ID: {account_id}')
|
||||||
|
return False
|
||||||
|
|
||||||
|
if person_id:
|
||||||
|
log.info(f'Person ID passed. Update existing Person below. Person ID: {person_id}')
|
||||||
|
|
||||||
|
if person_id := redis_lookup_id_random(record_id_random=person_id, table_name='person'): pass
|
||||||
|
else:
|
||||||
|
log.error('Person ID passed but is invalid. Failed requirement.')
|
||||||
|
return False
|
||||||
|
# person_obj.id = person_id
|
||||||
|
else:
|
||||||
|
log.info('No Person ID passed. Create new Person below. Required: Account ID')
|
||||||
|
|
||||||
|
log.debug(type(person_dict_obj))
|
||||||
|
log.info('Create dictionary or Pydantic object variables...')
|
||||||
|
if isinstance(person_dict_obj, dict):
|
||||||
|
person_dict = person_dict_obj
|
||||||
|
person_dict['account_id'] = account_id
|
||||||
|
if person_id:
|
||||||
|
person_dict['person_id'] = person_id
|
||||||
|
try:
|
||||||
|
person_obj = Person_Base(**person_dict)
|
||||||
|
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
|
log.debug(person_obj)
|
||||||
|
except ValidationError as e:
|
||||||
|
log.error(e.json())
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
person_obj = person_dict_obj
|
||||||
|
person_obj.account_id = account_id
|
||||||
|
if person_id:
|
||||||
|
# NOTE: Can't update the ID alias if it was never set.
|
||||||
|
person_obj.id = person_id
|
||||||
|
|
||||||
|
person_dict = person_obj.dict(by_alias=False, exclude_defaults=False, exclude_unset=True, exclude={'contact', 'organization', 'user', 'created_on', 'updated_on'})
|
||||||
|
|
||||||
|
log.info(f'SQL INSERT or UPDATE record... Person ID: {person_id}')
|
||||||
|
if person_id:
|
||||||
|
if person_dict_up_result := sql_update(data=person_dict, table_name='person', rm_id_random=True): pass
|
||||||
|
else:
|
||||||
|
log.warning(f'Person not updated. Person ID: {person_id}')
|
||||||
|
log.debug(person_dict_up_result)
|
||||||
|
return False
|
||||||
|
log.debug(person_dict_up_result)
|
||||||
|
else:
|
||||||
|
if person_dict_in_result := sql_insert(data=person_dict, table_name='person', rm_id_random=True, id_random_length=default_num_bytes): pass
|
||||||
|
else:
|
||||||
|
log.warning(f'Person not created.')
|
||||||
|
log.debug(person_dict_in_result)
|
||||||
|
return False
|
||||||
|
log.debug(person_dict_in_result)
|
||||||
|
|
||||||
|
person_id = person_dict_in_result
|
||||||
|
|
||||||
|
person_outline = {}
|
||||||
|
person_outline['person_id'] = person_id
|
||||||
|
|
||||||
|
# Updated 2021-09-08
|
||||||
|
log.info(f'Check if processing Contact data...')
|
||||||
|
# NOTE: Use object model version because of better type checking and validations
|
||||||
|
if process_contact and person_obj.contact:
|
||||||
|
person_outline['contact_id'] = None
|
||||||
|
contact_obj = person_obj.contact
|
||||||
|
if contact_id := person_obj.contact_id : pass
|
||||||
|
elif contact_id := contact_obj.id: pass
|
||||||
|
else: contact_id = None
|
||||||
|
contact_obj.id
|
||||||
|
contact_obj.for_type = 'person'
|
||||||
|
contact_obj.for_id = person_id
|
||||||
|
create_update_contact_obj_result = create_update_contact_obj_v4(
|
||||||
|
account_id = account_id,
|
||||||
|
contact_dict_obj = contact_obj,
|
||||||
|
contact_id = contact_id,
|
||||||
|
for_type = 'person',
|
||||||
|
for_id = person_id,
|
||||||
|
# process_address = process_address,
|
||||||
|
# create_sub_obj = create_sub_obj,
|
||||||
|
fail_any = fail_any,
|
||||||
|
return_outline = return_outline,
|
||||||
|
)
|
||||||
|
if isinstance(create_update_contact_obj_result, int):
|
||||||
|
contact_id = create_update_contact_obj_result
|
||||||
|
elif create_update_contact_obj_result == True: pass
|
||||||
|
else:
|
||||||
|
log.warning(f'Create or Update failed while trying create_update_contact_obj_v4(): {create_update_contact_obj_result}')
|
||||||
|
contact_id = None
|
||||||
|
|
||||||
|
person_outline['contact_id'] = contact_id
|
||||||
|
|
||||||
|
# Updated 2021-09-08
|
||||||
|
log.info(f'Check if processing Organization data...')
|
||||||
|
if process_organization and person_obj.organization:
|
||||||
|
organization_obj = person_obj.organization
|
||||||
|
organization_id = person_obj.organization_id_random
|
||||||
|
organization_result = create_update_organization_obj(
|
||||||
|
organization_id = organization_id,
|
||||||
|
organization_obj = organization_obj,
|
||||||
|
process_contact = True, # Setting to True under the assumption that if there is organization information then there is probably a contact (and address).
|
||||||
|
)
|
||||||
|
log.debug(organization_result)
|
||||||
|
if isinstance(organization_result, bool) and organization_result is True:
|
||||||
|
pass # Do not need to update person object.
|
||||||
|
elif isinstance(organization_result, bool) and organization_result is False:
|
||||||
|
pass # Do not need to update person object.
|
||||||
|
elif isinstance(organization_result, int):
|
||||||
|
person_obj.organization_id = organization_result
|
||||||
|
organization_id = organization_result
|
||||||
|
else:
|
||||||
|
log.warning('Something may have gone wrong while trying to create or update a organization.')
|
||||||
|
|
||||||
|
log.info(f'Check if need to update the Person with the Organization ID... Update Person Obj: {update_person_obj} Organization ID: {organization_id}')
|
||||||
|
if update_person_obj and isinstance(organization_id, int):
|
||||||
|
log.info(f'Updating the Person with the new/current Organization ID. Organization ID: {organization_id}')
|
||||||
|
person_data_up = {}
|
||||||
|
person_data_up['id'] = person_id
|
||||||
|
person_data_up['organization_id'] = organization_id
|
||||||
|
if person_data_up_result := sql_update(data=person_data_up, table_name='person'):
|
||||||
|
log.info(f'Person updated with Organization ID. Person ID: {person_id} Organization ID: {organization_id}')
|
||||||
|
else:
|
||||||
|
log.error(f'Person not updated with current Organization ID. Person ID: {person_id} Organization ID: {organization_id}')
|
||||||
|
if fail_any: return False
|
||||||
|
log.debug(person_dict_up_result)
|
||||||
|
|
||||||
|
person_outline['organization_id'] = organization_id
|
||||||
|
|
||||||
|
# Updated 2021-09-08
|
||||||
|
log.info(f'Check if processing User data... Process User: {process_user}')
|
||||||
|
if process_user and person_obj.user:
|
||||||
|
log.info(f'User data was found. Create a new User and link it to the new Person or update existing User. Person ID: {person_id}')
|
||||||
|
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
|
user_obj = person_obj.user
|
||||||
|
user_id = person_obj.user_id
|
||||||
|
update_person_obj = False
|
||||||
|
log.debug(user_obj)
|
||||||
|
if user_id:
|
||||||
|
log.warning('User ID found. This is not expected, but should be ok.')
|
||||||
|
# from app.methods.user_methods import update_user_obj_v3
|
||||||
|
from app.methods.user_methods import update_user_obj
|
||||||
|
if update_user_obj_result := update_user_obj(
|
||||||
|
user_id = user_id,
|
||||||
|
user_obj_up = user_obj,
|
||||||
|
# create_sub_obj = create_sub_obj,
|
||||||
|
# fail_any = fail_any,
|
||||||
|
):
|
||||||
|
log.info(f'User updated. User ID: {user_id}')
|
||||||
|
log.debug(update_user_obj_result)
|
||||||
|
|
||||||
|
# NOTE: This should not be needed. Updating person just in case!
|
||||||
|
update_person_obj = True
|
||||||
|
else:
|
||||||
|
log.warning(f'User not updated. Person ID: {person_id}')
|
||||||
|
log.debug(update_user_obj_result)
|
||||||
|
user_id = None
|
||||||
|
if fail_any: return False
|
||||||
|
|
||||||
|
# if isinstance(update_user_obj_result, int):
|
||||||
|
# user_id = update_user_obj_result
|
||||||
|
# log.info(f'User updated. User ID: {user_id}')
|
||||||
|
# # Need to update the person with the current user_id
|
||||||
|
# log.debug(person_dict_up_result)
|
||||||
|
# else:
|
||||||
|
# log.warning(f'User not updated. Person ID: {person_id}')
|
||||||
|
# log.debug(update_user_obj_result)
|
||||||
|
# user_id = None
|
||||||
|
# if fail_any: return False
|
||||||
|
else:
|
||||||
|
log.info(f'No User ID found.')
|
||||||
|
# from app.methods.user_methods import create_user_obj_v3
|
||||||
|
from app.methods.user_methods import create_user_obj
|
||||||
|
if create_user_obj_result := create_user_obj(
|
||||||
|
account_id = account_id,
|
||||||
|
user_obj_new = user_obj,
|
||||||
|
# create_sub_obj = create_sub_obj,
|
||||||
|
# fail_any = fail_any,
|
||||||
|
):
|
||||||
|
if isinstance(create_user_obj_result, int):
|
||||||
|
log.info(f'User created. User ID: {user_id}')
|
||||||
|
log.debug(update_user_obj_result)
|
||||||
|
user_id = create_user_obj_result
|
||||||
|
# Need to update the person with the new user_id
|
||||||
|
update_person_obj = True
|
||||||
|
else:
|
||||||
|
log.warning(f'User not created. Updated? Person ID: {person_id}')
|
||||||
|
log.debug(create_user_obj_result)
|
||||||
|
user_id = None
|
||||||
|
if fail_any: return False
|
||||||
|
else:
|
||||||
|
log.warning(f'User not created. Person ID: {person_id}')
|
||||||
|
log.debug(create_user_obj_result)
|
||||||
|
user_id = None
|
||||||
|
if fail_any: return False
|
||||||
|
|
||||||
|
log.info(f'Check if need to update the Person with the User ID... Update Person Obj: {update_person_obj} User ID: {user_id}')
|
||||||
|
if update_person_obj and isinstance(user_id, int):
|
||||||
|
log.info(f'Updating the Person with the new/current User ID. User ID: {user_id}')
|
||||||
|
person_data_up = {}
|
||||||
|
person_data_up['id'] = person_id
|
||||||
|
person_data_up['user_id'] = user_id
|
||||||
|
if person_data_up_result := sql_update(data=person_data_up, table_name='person'):
|
||||||
|
log.info(f'Person updated with User ID. Person ID: {person_id} User ID: {user_id}')
|
||||||
|
else:
|
||||||
|
log.error(f'Person not updated with current User ID. Person ID: {person_id} User ID: {user_id}')
|
||||||
|
if fail_any: return False
|
||||||
|
log.debug(person_dict_up_result)
|
||||||
|
|
||||||
|
person_outline['user_id'] = user_id
|
||||||
|
else:
|
||||||
|
log.info('User data not found.')
|
||||||
|
pass
|
||||||
|
|
||||||
|
return person_id
|
||||||
|
|
||||||
|
# Process person data
|
||||||
|
person_dict_up = person_obj.dict(by_alias=False, exclude_unset=True, exclude={'contact_id', 'contact_id_random', 'contact', 'organization', 'user'})
|
||||||
|
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
|
log.debug(person_obj)
|
||||||
|
log.debug(person_dict_up)
|
||||||
|
|
||||||
|
# Update record
|
||||||
|
person_up_result = sql_update(
|
||||||
|
data = person_dict_up,
|
||||||
|
table_name = 'person',
|
||||||
|
rm_id_random = True,
|
||||||
|
)
|
||||||
|
log.debug(person_up_result)
|
||||||
|
if isinstance(person_up_result, bool) and person_up_result is True:
|
||||||
|
return person_id
|
||||||
|
elif isinstance(person_up_result, bool) and person_up_result is False:
|
||||||
|
return False
|
||||||
|
elif isinstance(person_up_result, int):
|
||||||
|
return person_up_result
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
# ### END ### API Person Methods ### create_update_person_obj_v4b() ###
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ### BEGIN ### API Person Methods ### create_update_person_obj() ###
|
# ### BEGIN ### API Person Methods ### create_update_person_obj() ###
|
||||||
def create_update_person_obj(
|
def create_update_person_obj(
|
||||||
person_id: int|str|None, # Ideally the int ID should be passed. This allows for updating of the id_random value.
|
person_id: int|str|None, # Ideally the int ID should be passed. This allows for updating of the id_random value.
|
||||||
@@ -1169,11 +1275,15 @@ def create_update_person_obj(
|
|||||||
log.debug(locals())
|
log.debug(locals())
|
||||||
|
|
||||||
if person_id:
|
if person_id:
|
||||||
|
log.info(f'Person ID passed. Update existing Person. Person ID: {person_id}')
|
||||||
|
|
||||||
if person_id := redis_lookup_id_random(record_id_random=person_id, table_name='person'): pass
|
if person_id := redis_lookup_id_random(record_id_random=person_id, table_name='person'): pass
|
||||||
else: return False
|
else: return False
|
||||||
person_obj.id = person_id
|
person_obj.id = person_id
|
||||||
else:
|
else:
|
||||||
# Insert record now and update later
|
# Insert record now and update later
|
||||||
|
log.info('No Person ID passed. Create new Person. Required: Account ID')
|
||||||
|
|
||||||
person_dict_in = person_obj.dict(by_alias=False, exclude_unset=True, exclude={'contact_id', 'contact_id_random', 'contact', 'organization', 'user'})
|
person_dict_in = person_obj.dict(by_alias=False, exclude_unset=True, exclude={'contact_id', 'contact_id_random', 'contact', 'organization', 'user'})
|
||||||
log.debug(person_dict_in)
|
log.debug(person_dict_in)
|
||||||
person_in_result = sql_insert(
|
person_in_result = sql_insert(
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ def update_user_obj(
|
|||||||
create_sub_obj: bool = False,
|
create_sub_obj: bool = False,
|
||||||
fail_any: bool = True, # Fail if any thing goes wrong for sub objects
|
fail_any: bool = True, # Fail if any thing goes wrong for sub objects
|
||||||
return_dict: bool = False,
|
return_dict: bool = False,
|
||||||
) -> bool:
|
) -> bool|int:
|
||||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
log.debug(locals())
|
log.debug(locals())
|
||||||
|
|
||||||
@@ -231,6 +231,7 @@ def update_user_obj(
|
|||||||
if user_obj_up_result := sql_update(data=user_dict_up, table_name='user', rm_id_random=True):
|
if user_obj_up_result := sql_update(data=user_dict_up, table_name='user', rm_id_random=True):
|
||||||
log.debug(user_obj_up_result)
|
log.debug(user_obj_up_result)
|
||||||
return True
|
return True
|
||||||
|
# return user_id
|
||||||
else:
|
else:
|
||||||
log.debug(user_obj_up_result)
|
log.debug(user_obj_up_result)
|
||||||
return False
|
return False
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ class Person_Base(BaseModel):
|
|||||||
created_on: Optional[datetime.datetime] = None
|
created_on: Optional[datetime.datetime] = None
|
||||||
updated_on: Optional[datetime.datetime] = None
|
updated_on: Optional[datetime.datetime] = None
|
||||||
|
|
||||||
|
test_field: str = 'asdf 1234'
|
||||||
|
|
||||||
# Convenience Data
|
# Convenience Data
|
||||||
# This is only for convenience. Probably going to keep unless it causes a problem.
|
# This is only for convenience. Probably going to keep unless it causes a problem.
|
||||||
email: Optional[str]
|
email: Optional[str]
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ from app.models.user_models import User_New_Base, User_Base
|
|||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
# ### BEGIN ### API Event Person ### post_event_person_obj_new_v4() ###
|
# ### BEGIN ### API Event Person ### v4_post_event_person_obj_new() ###
|
||||||
# Updated 2021-08-25
|
# Updated 2021-08-25
|
||||||
@router.post('/event/person/new_v4', response_model=Resp_Body_Base)
|
@router.post('/v4/event/person/new', response_model=Resp_Body_Base)
|
||||||
async def post_event_person_obj_new_v4(
|
async def v4_post_event_person_obj_new(
|
||||||
event_person_obj: Event_Person_Base,
|
event_person_obj: Event_Person_Base,
|
||||||
create_sub_obj: bool = False,
|
create_sub_obj: bool = False,
|
||||||
fail_any: bool = True, # Fail if any thing goes wrong for sub objects
|
fail_any: bool = True, # Fail if any thing goes wrong for sub objects
|
||||||
@@ -81,13 +81,13 @@ async def post_event_person_obj_new_v4(
|
|||||||
return mk_resp(data=data, response=response, status_message='The event person was created.')
|
return mk_resp(data=data, response=response, status_message='The event person was created.')
|
||||||
else:
|
else:
|
||||||
return mk_resp(data=False, status_code=400, response=response, status_message='The result from trying to create an event person was unexpected.')
|
return mk_resp(data=False, status_code=400, response=response, status_message='The result from trying to create an event person was unexpected.')
|
||||||
# ### BEGIN ### API Event Person ### post_event_person_obj_new_v4() ###
|
# ### BEGIN ### API Event Person ### v4_post_event_person_obj_new() ###
|
||||||
|
|
||||||
|
|
||||||
# ### BEGIN ### API Event Person ### patch_event_person_obj_exist_v4() ###
|
# ### BEGIN ### API Event Person ### v4_patch_event_person_obj_exist() ###
|
||||||
# Updated 2021-08-25
|
# Updated 2021-08-25
|
||||||
@router.patch('/event/person/{event_person_id}/exist_v4', response_model=Resp_Body_Base)
|
@router.patch('/v4/event/person/{event_person_id}/exist', response_model=Resp_Body_Base)
|
||||||
async def patch_event_person_obj_exist_v4(
|
async def v4_patch_event_person_obj_exist(
|
||||||
event_person_obj: Event_Person_Base,
|
event_person_obj: Event_Person_Base,
|
||||||
event_person_id: str = Query(..., min_length=11, max_length=22),
|
event_person_id: str = Query(..., min_length=11, max_length=22),
|
||||||
create_sub_obj: bool = False,
|
create_sub_obj: bool = False,
|
||||||
@@ -142,16 +142,16 @@ async def patch_event_person_obj_exist_v4(
|
|||||||
return mk_resp(data=data, response=response, status_message='The event person was created.')
|
return mk_resp(data=data, response=response, status_message='The event person was created.')
|
||||||
else:
|
else:
|
||||||
return mk_resp(data=False, status_code=400, response=response, status_message='The result from trying to create an event person was unexpected.')
|
return mk_resp(data=False, status_code=400, response=response, status_message='The result from trying to create an event person was unexpected.')
|
||||||
# ### END ### API Event Person ### patch_event_person_obj_exist_v4() ###
|
# ### END ### API Event Person ### v4_patch_event_person_obj_exist() ###
|
||||||
|
|
||||||
|
|
||||||
# ### BEGIN ### API Event Person Route ### post_event_person_new() ###
|
# ### BEGIN ### API Event Person Route ### v2_post_event_person_new() ###
|
||||||
# Initialize/create a new event person
|
# Initialize/create a new event person
|
||||||
# Create a person record (with a contact record and an address for the contact record)
|
# Create a person record (with a contact record and an address for the contact record)
|
||||||
# Create a user record
|
# Create a user record
|
||||||
# Create an event_person record with the new person and user IDs
|
# Create an event_person record with the new person and user IDs
|
||||||
@router.post('/event/person/new', response_model=Resp_Body_Base)
|
@router.post('/v2/event/person/new', response_model=Resp_Body_Base)
|
||||||
async def post_event_person_new(
|
async def v2_post_event_person_new(
|
||||||
event_person_new_init: Event_Person_New_Base,
|
event_person_new_init: Event_Person_New_Base,
|
||||||
x_account_id: str = Header(...),
|
x_account_id: str = Header(...),
|
||||||
return_obj: bool = True,
|
return_obj: bool = True,
|
||||||
@@ -332,7 +332,7 @@ async def post_event_person_new(
|
|||||||
|
|
||||||
return mk_resp(data=event_person_dict)
|
return mk_resp(data=event_person_dict)
|
||||||
#return mk_resp(data=event_person_obj)
|
#return mk_resp(data=event_person_obj)
|
||||||
# ### BEGIN ### API Event Person Route ### post_event_person_new() ###
|
# ### BEGIN ### API Event Person Route ### v2_post_event_person_new() ###
|
||||||
|
|
||||||
|
|
||||||
# ### BEGIN ### API Event Person ### patch_event_person_json() ###
|
# ### BEGIN ### API Event Person ### patch_event_person_json() ###
|
||||||
@@ -393,7 +393,7 @@ async def get_event_person_obj(
|
|||||||
#inc_event_person_list: bool = False,
|
#inc_event_person_list: bool = False,
|
||||||
inc_event_person_profile: bool = False,
|
inc_event_person_profile: bool = False,
|
||||||
inc_event_presentation_list: bool = False,
|
inc_event_presentation_list: bool = False,
|
||||||
#inc_event_presenter_list: bool = False,
|
inc_event_presenter_list: bool = False,
|
||||||
inc_event_registration: bool = False,
|
inc_event_registration: bool = False,
|
||||||
#inc_event_track: bool = False,
|
#inc_event_track: bool = False,
|
||||||
inc_person: bool = False,
|
inc_person: bool = False,
|
||||||
@@ -425,7 +425,7 @@ async def get_event_person_obj(
|
|||||||
#inc_event_person_list = inc_event_person_list,
|
#inc_event_person_list = inc_event_person_list,
|
||||||
inc_event_person_profile = inc_event_person_profile,
|
inc_event_person_profile = inc_event_person_profile,
|
||||||
inc_event_presentation_list = inc_event_presentation_list,
|
inc_event_presentation_list = inc_event_presentation_list,
|
||||||
#inc_event_presenter_list = inc_event_presenter_list,
|
inc_event_presenter_list = inc_event_presenter_list,
|
||||||
inc_event_registration = inc_event_registration,
|
inc_event_registration = inc_event_registration,
|
||||||
#inc_event_track = inc_event_track,
|
#inc_event_track = inc_event_track,
|
||||||
inc_person = inc_person,
|
inc_person = inc_person,
|
||||||
|
|||||||
@@ -476,6 +476,7 @@ async def get_event_session_obj(
|
|||||||
inc_event_file_list: bool = False,
|
inc_event_file_list: bool = False,
|
||||||
inc_event_location: bool = False,
|
inc_event_location: bool = False,
|
||||||
inc_event_person: bool = False, # Under event_presenter
|
inc_event_person: bool = False, # Under event_presenter
|
||||||
|
inc_event_person_profile: bool = False, # Under event_person
|
||||||
inc_event_person_list: bool = False,
|
inc_event_person_list: bool = False,
|
||||||
inc_event_presentation_list: bool = False,
|
inc_event_presentation_list: bool = False,
|
||||||
inc_event_presenter_cat: bool = False,
|
inc_event_presenter_cat: bool = False,
|
||||||
@@ -509,6 +510,7 @@ async def get_event_session_obj(
|
|||||||
inc_event_file_list = inc_event_file_list,
|
inc_event_file_list = inc_event_file_list,
|
||||||
inc_event_location = inc_event_location,
|
inc_event_location = inc_event_location,
|
||||||
inc_event_person = inc_event_person,
|
inc_event_person = inc_event_person,
|
||||||
|
inc_event_person_profile = inc_event_person_profile,
|
||||||
inc_event_person_list = inc_event_person_list,
|
inc_event_person_list = inc_event_person_list,
|
||||||
inc_event_presentation_list = inc_event_presentation_list,
|
inc_event_presentation_list = inc_event_presentation_list,
|
||||||
inc_event_presenter_cat = inc_event_presenter_cat,
|
inc_event_presenter_cat = inc_event_presenter_cat,
|
||||||
|
|||||||
@@ -72,10 +72,10 @@ async def patch_person_obj(
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
# ### BEGIN ### API Person ### post_person_obj_new_v3() ###
|
# ### BEGIN ### API Person ### v3_post_person_obj_new() ###
|
||||||
# Updated 2021-08-24
|
# Updated 2021-08-24
|
||||||
@router.post('/person/new_v3', response_model=Resp_Body_Base)
|
@router.post('/v3/person/new', response_model=Resp_Body_Base)
|
||||||
async def post_person_obj_new_v3(
|
async def v3_post_person_obj_new(
|
||||||
person_obj: Person_Base,
|
person_obj: Person_Base,
|
||||||
create_sub_obj: bool = False,
|
create_sub_obj: bool = False,
|
||||||
fail_any: bool = True, # Fail if any thing goes wrong for sub objects
|
fail_any: bool = True, # Fail if any thing goes wrong for sub objects
|
||||||
@@ -132,13 +132,13 @@ async def post_person_obj_new_v3(
|
|||||||
return mk_resp(data=data, response=response, status_message='The person was created.')
|
return mk_resp(data=data, response=response, status_message='The person was created.')
|
||||||
else:
|
else:
|
||||||
return mk_resp(data=False, status_code=400, response=response, status_message='The result from trying to create an person was unexpected.')
|
return mk_resp(data=False, status_code=400, response=response, status_message='The result from trying to create an person was unexpected.')
|
||||||
# ### BEGIN ### API Person ### post_person_obj_new_v3() ###
|
# ### BEGIN ### API Person ### v3_post_person_obj_new() ###
|
||||||
|
|
||||||
|
|
||||||
# ### BEGIN ### API Person ### patch_person_obj_exist_v3() ###
|
# ### BEGIN ### API Person ### v3_patch_person_obj_exist ###
|
||||||
# Updated 2021-08-24
|
# Updated 2021-08-24
|
||||||
@router.patch('/person/{person_id}/exist_v3', response_model=Resp_Body_Base)
|
@router.patch('/v3/person/{person_id}/exist', response_model=Resp_Body_Base)
|
||||||
async def patch_person_obj_exist_v3(
|
async def v3_patch_person_obj_exist(
|
||||||
person_obj: Person_Base,
|
person_obj: Person_Base,
|
||||||
person_id: str = Query(..., min_length=11, max_length=22),
|
person_id: str = Query(..., min_length=11, max_length=22),
|
||||||
create_sub_obj: bool = False,
|
create_sub_obj: bool = False,
|
||||||
@@ -179,7 +179,7 @@ async def patch_person_obj_exist_v3(
|
|||||||
return mk_resp(data=data, response=response, status_message='The person was created.')
|
return mk_resp(data=data, response=response, status_message='The person was created.')
|
||||||
else:
|
else:
|
||||||
return mk_resp(data=False, status_code=400, response=response, status_message='The result from trying to create an person was unexpected.')
|
return mk_resp(data=False, status_code=400, response=response, status_message='The result from trying to create an person was unexpected.')
|
||||||
# ### END ### API Person ### patch_person_obj_exist_v3() ###
|
# ### END ### API Person ### v3_patch_person_obj_exist ###
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -390,7 +390,8 @@ async def get_person_obj(
|
|||||||
if person_dict := load_person_obj(
|
if person_dict := load_person_obj(
|
||||||
person_id = person_id,
|
person_id = person_id,
|
||||||
limit = limit,
|
limit = limit,
|
||||||
model_as_dict = True, # NOTE: returning model as a dict
|
exclude_unset = False,
|
||||||
|
model_as_dict = False, # NOTE: returning model as a dict
|
||||||
enabled = enabled,
|
enabled = enabled,
|
||||||
inc_address = inc_address,
|
inc_address = inc_address,
|
||||||
# inc_archive_list = inc_archive_list,
|
# inc_archive_list = inc_archive_list,
|
||||||
|
|||||||
Reference in New Issue
Block a user