Work on event, event_session, event_presentation, event_presenter, user, and person routes, methods, and models

This commit is contained in:
Scott Idem
2021-08-21 16:04:17 -04:00
parent 67b8435e08
commit 824bdd29a2
19 changed files with 631 additions and 80 deletions

View File

@@ -207,6 +207,19 @@ def create_event_person_obj(event_person_obj_new:Event_Person_Base) -> int|bool:
event_person_id = event_person_obj_in_result
# Linked to (from event_person)
if event_person_obj_new.event_badge and event_person_obj_new.event_badge_id: pass
if event_person_obj_new.event_badge_vendor and event_person_obj_new.event_badge_vendor_id: pass
if event_person_obj_new.event_badge_vip and event_person_obj_new.event_badge_vip_id: pass
if event_person_obj_new.event_registration and event_person_obj_new.event_registration_id: pass
# Linked from
if event_person_obj_new.event and event_person_obj_new.poc_event_id: pass # POC for event; only one
if event_person_obj_new.event_presenter and event_person_obj_new.event_presenter_id: pass # actual presenter; could be more than one
if event_person_obj_new.event_session and event_person_obj_new.poc_event_session_id: pass # POC for event session; could be more than one
if event_person_obj_new.event_registration and event_person_obj_new.poc_event_registration_id: pass # Primary registrant for registration; only one
log.debug(f'Returning the new event_person_id: {event_person_id}')
return event_person_id
# ### END ### API Event Person Methods ### create_event_person_obj() ###
@@ -299,3 +312,107 @@ def update_event_person_obj(
log.debug(event_person_obj_up_result)
return False
# ### END ### API Event Person Methods ### update_event_person_obj() ###
# ### BEGIN ### API Event Person Methods ### create_event_person_obj() ###
# NOTE: This will create an event_person. This event_person should include at least a person_id.
# NOTE: Is it a good idea to create and or update a person and or user here??? The create_event_person_obj() below does do that.
# Reviewed and updated 2021-08-10
def smart_event_person_obj(event_person_obj_new:Event_Person_Base) -> int|bool:
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
if event_person_id := event_person_obj_new.event_person_id: pass
if event_id := event_person_obj_new.event_id: pass
if event_presentation_id := event_person_obj_new.event_presentation_id: pass
if event_session_id := event_person_obj_new.event_session_id: pass
# 1: Pull out the event_person data and possible sub object data
# event_person
# if not event_person_id: create_event_person
# if event_person_id: update_event_person
#
# event
# event_badge
# event_presenter # could be more than one
# event_registration # POC/primary or secondary
# event_session # could be more than one
# def create_event_person():
# 1: Pull out the event_person data and possible sub object data
# event
# ignore for now
# event_badge
# ignore for now
# event_presenter # could be more than one
# if event_id and event_session_id and event_presentation_id and not event_presenter_id: create_event_presenter
# if event_presenter_id: update_event_presenter
# event_registration # POC/primary or secondary
# ignore for now
# event_session # could be more than one
# if event_id and not event_session_id: create_event_session
# if event_session_id: update_event_session
# def update_event_person():
# 1: Pull out the event_person data and possible sub object data
# event
# ignore for now
# event_badge
# ignore for now
# event_presenter # could be more than one
# if event_id and event_session_id and event_presentation_id and not event_presenter_id: create_event_presenter
# if event_presenter_id: update_event_presenter
# event_registration # POC/primary or secondary
# ignore for now
# event_session # could be more than one
# if event_id and not event_session_id: create_event_session
# if event_session_id: update_event_session
event_person_obj_data = event_person_obj_new.dict(by_alias=False, exclude_defaults=False, exclude_unset=True, exclude={'created_on', 'updated_on'})
log.debug(event_person_obj_data)
if event_person_obj_in_result := sql_insert(data=event_person_obj_data, table_name='event_person', rm_id_random=True, id_random_length=8): pass
else:
return False
#log.setLevel(logging.DEBUG)
log.debug(event_person_obj_in_result)
event_person_id = event_person_obj_in_result
# Linked to (from event_person)
if event_person_obj_new.event_badge and event_person_obj_new.event_badge_id: pass
if event_person_obj_new.event_badge_vendor and event_person_obj_new.event_badge_vendor_id: pass
if event_person_obj_new.event_badge_vip and event_person_obj_new.event_badge_vip_id: pass
if event_person_obj_new.event_registration and event_person_obj_new.event_registration_id: pass
# Linked from
if event_person_obj_new.event and event_person_obj_new.poc_event_id: pass # POC for event; only one
if event_person_obj_new.event_presenter and event_person_obj_new.event_presenter_id: pass # actual presenter; could be more than one
if event_person_obj_new.event_session and event_person_obj_new.poc_event_session_id: pass # POC for event session; could be more than one
if event_person_obj_new.event_registration and event_person_obj_new.poc_event_registration_id: pass # Primary registrant for registration; only one
log.debug(f'Returning the new event_person_id: {event_person_id}')
return event_person_id
# ### END ### API Event Person Methods ### create_event_person_obj() ###