A lot of work on event related modules. Also a lot of clean up.
This commit is contained in:
@@ -52,6 +52,8 @@ def load_event_person_obj(
|
||||
event_person_id: int|str,
|
||||
enabled: str = 'enabled', # enabled, disabled, all
|
||||
limit: int = 1000,
|
||||
inc_address: bool = False,
|
||||
inc_contact: bool = False,
|
||||
inc_event_abstract_list: bool = False,
|
||||
inc_event_badge: bool = False,
|
||||
inc_event_exhibit_list: bool = False,
|
||||
@@ -105,7 +107,11 @@ def load_event_person_obj(
|
||||
|
||||
if inc_person:
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
if person_obj := load_person_obj(person_id=person_id):
|
||||
if person_obj := load_person_obj(
|
||||
inc_address=inc_address,
|
||||
inc_contact=inc_contact,
|
||||
person_id=person_id
|
||||
):
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(person_obj)
|
||||
event_person_obj.person = person_obj.dict(by_alias=True, exclude_unset=True)
|
||||
|
||||
@@ -23,6 +23,8 @@ def load_event_presentation_obj(
|
||||
event_presentation_id: int|str,
|
||||
enabled: str = 'enabled', # enabled, disabled, all
|
||||
limit: int = 1000,
|
||||
inc_address: bool = False,
|
||||
inc_contact: bool = False,
|
||||
inc_event_abstract_list: bool = False,
|
||||
inc_event_badge: bool = False,
|
||||
#inc_event_badge_list: bool = False,
|
||||
@@ -96,7 +98,7 @@ def load_event_presentation_obj(
|
||||
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 `event_presenter`.event_presenter_id = :event_presenter_id
|
||||
WHERE `event_presenter`.event_presentation_id = :event_presentation_id
|
||||
{sql_enabled}
|
||||
ORDER BY `event_presenter`.created_on DESC, `event_presenter`.updated_on DESC;
|
||||
"""
|
||||
@@ -111,6 +113,8 @@ def load_event_presentation_obj(
|
||||
if event_presenter_obj := load_event_presenter_obj(
|
||||
event_presenter_id=event_presenter_id,
|
||||
enabled=enabled,
|
||||
inc_address=inc_address,
|
||||
inc_contact=inc_contact,
|
||||
inc_event_abstract_list=inc_event_abstract_list,
|
||||
inc_event_badge=inc_event_badge,
|
||||
inc_event_device_list=inc_event_device_list,
|
||||
@@ -123,10 +127,11 @@ def load_event_presentation_obj(
|
||||
data = event_presenter_obj.dict(by_alias=True, exclude_unset=True)
|
||||
event_presenter_obj_li.append(data)
|
||||
log.debug(event_presenter_obj_li)
|
||||
event_presenter_obj.event_presenter_list = event_presenter_obj_li
|
||||
event_presentation_obj.event_presenter_list = event_presenter_obj_li
|
||||
else:
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(event_presenter_obj_li_result)
|
||||
event_presentation_obj.event_presenter_list = []
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
#if inc_user: pass
|
||||
else:
|
||||
|
||||
@@ -21,6 +21,8 @@ def load_event_presenter_obj(
|
||||
event_presenter_id: int|str,
|
||||
enabled: str = 'enabled', # enabled, disabled, all
|
||||
limit: int = 1000,
|
||||
inc_address: bool = False,
|
||||
inc_contact: bool = False,
|
||||
inc_event_abstract_list: bool = False, # For event_presenter and using load_event_person_obj
|
||||
inc_event_badge: bool = False, # Using load_event_person_obj
|
||||
inc_event_device_list: bool = False, # For event_presenter and using load_event_person_obj
|
||||
@@ -72,6 +74,8 @@ def load_event_presenter_obj(
|
||||
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,
|
||||
@@ -82,6 +86,7 @@ def load_event_presenter_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:
|
||||
|
||||
@@ -10,6 +10,7 @@ from app.lib_general import log, logging
|
||||
# from app.methods.event_methods import load_event_obj
|
||||
# from app.methods.event_file_methods import load_event_file_obj
|
||||
from app.methods.event_location_methods import load_event_location_obj
|
||||
from app.methods.event_person_methods import load_event_person_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.person_methods import load_person_obj
|
||||
@@ -23,11 +24,14 @@ def load_event_session_obj(
|
||||
event_session_id: int|str,
|
||||
enabled: str = 'enabled', # enabled, disabled, all
|
||||
limit: int = 1000,
|
||||
inc_address: bool = False,
|
||||
inc_contact: bool = False,
|
||||
inc_event_abstract_list: bool = False,
|
||||
inc_event_badge_list: bool = False,
|
||||
inc_event_device_list: bool = False,
|
||||
inc_event_file_list: bool = False,
|
||||
inc_event_location: bool = False,
|
||||
inc_event_person: bool = False,
|
||||
inc_event_person_list: bool = False,
|
||||
inc_event_presentation_list: bool = False,
|
||||
inc_event_presenter_cat: bool = False, # Concantinate presenter names
|
||||
@@ -35,8 +39,8 @@ def load_event_session_obj(
|
||||
inc_event_registration_list: bool = False,
|
||||
inc_event_track: bool = False,
|
||||
inc_poc_event_person: bool = False,
|
||||
# inc_poc_person: bool = False,
|
||||
# inc_user: bool = False,
|
||||
inc_person: bool = False,
|
||||
inc_user: bool = False,
|
||||
) -> Event_Session_Base|bool:
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -63,7 +67,6 @@ def load_event_session_obj(
|
||||
event_location_id = event_session_rec.get('event_location_id', None)
|
||||
event_track_id = event_session_rec.get('event_track_id', None)
|
||||
poc_event_person_id = event_session_rec.get('poc_event_person_id', None)
|
||||
poc_person_id = event_session_rec.get('poc_person_id', None)
|
||||
|
||||
#if inc_event: pass
|
||||
if inc_event_abstract_list: pass
|
||||
@@ -125,11 +128,16 @@ def load_event_session_obj(
|
||||
if event_presentation_obj := load_event_presentation_obj(
|
||||
event_presentation_id=event_presentation_id,
|
||||
enabled=enabled,
|
||||
inc_address=inc_address,
|
||||
inc_contact=inc_contact,
|
||||
inc_event_abstract_list=inc_event_abstract_list,
|
||||
inc_event_device_list=inc_event_device_list,
|
||||
inc_event_file_list=inc_event_file_list,
|
||||
inc_event_person=inc_event_person,
|
||||
inc_event_person_list=inc_event_person_list,
|
||||
inc_event_presenter_list=inc_event_presenter_list,
|
||||
inc_person=inc_person,
|
||||
inc_user=inc_user
|
||||
):
|
||||
data = event_presentation_obj.dict(by_alias=True, exclude_unset=True)
|
||||
event_presentation_obj_li.append(data)
|
||||
@@ -138,6 +146,7 @@ def load_event_session_obj(
|
||||
else:
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(event_presentation_rec_li_result)
|
||||
event_session_obj.event_presentation_list = []
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
|
||||
if inc_event_presenter_cat:
|
||||
@@ -161,11 +170,15 @@ def load_event_session_obj(
|
||||
if inc_event_presenter_list: pass
|
||||
|
||||
if inc_poc_event_person:
|
||||
poc_event_person_obj = load_person_obj(person_id=poc_person_id)
|
||||
poc_event_person_obj = load_event_person_obj(
|
||||
event_person_id=poc_event_person_id,
|
||||
inc_address=inc_address,
|
||||
inc_contact=inc_contact,
|
||||
inc_person=inc_person,
|
||||
inc_user=inc_user
|
||||
)
|
||||
log.debug(poc_event_person_obj)
|
||||
event_session_obj.poc_event_person = poc_event_person_obj
|
||||
log.debug(event_session_obj)
|
||||
|
||||
#if inc_user: pass
|
||||
|
||||
return event_session_obj
|
||||
@@ -62,8 +62,8 @@ def create_person_obj(person_obj_new:Person_Base):
|
||||
# ### BEGIN ### API Person Methods ### load_person_obj() ###
|
||||
def load_person_obj(
|
||||
person_id: int|str,
|
||||
inc_address: bool = False, # Under contact
|
||||
inc_contact: bool = False,
|
||||
inc_address: bool = False,
|
||||
inc_organization: bool = False,
|
||||
inc_user: bool = False
|
||||
) -> Person_Base|bool:
|
||||
|
||||
@@ -11,7 +11,7 @@ from .common_field_schema import base_fields, default_num_bytes
|
||||
|
||||
#from .event_models import Event_Base
|
||||
from .event_location_models import Event_Location_Base
|
||||
#from .event_person_models import Event_Person_Base # NOTE: Using thi will probably create an import loop
|
||||
from .event_person_models import Event_Person_Base # NOTE: Using thi will probably create an import loop
|
||||
from .event_track_models import Event_Track_Base
|
||||
from .person_models import Person_Base
|
||||
|
||||
@@ -98,7 +98,7 @@ class Event_Session_Base(BaseModel):
|
||||
event_presentation_list: Optional[list] # Optional[Event_Presentation_Base]
|
||||
event_presenter_list: Optional[list] # Optional[Event_Presenter_Base]
|
||||
event_track: Optional[Event_Track_Base]
|
||||
#poc_event_person: Optional[Event_Person_Base] # NOTE: Using thi will probably create an import loop
|
||||
poc_event_person: Optional[Event_Person_Base] # NOTE: Using thi will probably create an import loop
|
||||
|
||||
_processed_at: datetime.datetime = PrivateAttr(default_factory=datetime.datetime.now)
|
||||
|
||||
|
||||
@@ -177,6 +177,8 @@ async def get_event_person_obj(
|
||||
event_person_id: str = Query(..., min_length=1, max_length=22),
|
||||
enabled: str = 'enabled', # For now this covers any included objects or object lists
|
||||
limit: int = 500, # For now this covers any included objects or object lists
|
||||
inc_address: bool = False, # Under contact
|
||||
inc_contact: bool = False, # Under person
|
||||
inc_event_abstract_list: bool = False,
|
||||
inc_event_badge: bool = False,
|
||||
#inc_event_device_list: bool = False,
|
||||
@@ -205,6 +207,8 @@ async def get_event_person_obj(
|
||||
event_person_id=event_person_id,
|
||||
enabled=enabled,
|
||||
limit=limit,
|
||||
inc_address=inc_address,
|
||||
inc_contact=inc_contact,
|
||||
inc_event_abstract_list=inc_event_abstract_list,
|
||||
inc_event_badge=inc_event_badge,
|
||||
#inc_event_device_list=inc_event_device_list,
|
||||
|
||||
@@ -79,6 +79,8 @@ async def get_event_presentation_obj(
|
||||
event_presentation_id: str = Query(..., min_length=1, max_length=22),
|
||||
enabled: str = 'enabled', # enabled, disabled, all; For now this covers any included objects or object lists
|
||||
limit: int = 500, # For now this covers any included objects or object lists
|
||||
inc_address: bool = False, # Under contact
|
||||
inc_contact: bool = False, # Under person
|
||||
inc_event_abstract_list: bool = False,
|
||||
inc_event_badge: bool = False,
|
||||
inc_event_badge_list: bool = False,
|
||||
@@ -106,6 +108,8 @@ async def get_event_presentation_obj(
|
||||
event_presentation_id=event_presentation_id,
|
||||
enabled=enabled,
|
||||
limit=limit,
|
||||
inc_address=inc_address,
|
||||
inc_contact=inc_contact,
|
||||
inc_event_abstract_list=inc_event_abstract_list,
|
||||
inc_event_badge=inc_event_badge,
|
||||
# inc_event_badge_list=inc_event_badge_list,
|
||||
|
||||
@@ -196,6 +196,8 @@ async def get_event_presenter_obj(
|
||||
event_presenter_id: str = Query(..., min_length=1, max_length=22),
|
||||
enabled: str = 'enabled', # enabled, disabled, all; For now this covers any included objects or object lists
|
||||
limit: int = 500, # For now this covers any included objects or object lists
|
||||
inc_address: bool = False, # Under contact
|
||||
inc_contact: bool = False, # Under person
|
||||
inc_event_abstract_list: bool = False, # Part of event_presenter and under event_person obj
|
||||
inc_event_badge: bool = False, # Under event_person obj
|
||||
inc_event_device_list: bool = False, # Part of event_presenter and under event_person obj
|
||||
@@ -224,6 +226,8 @@ async def get_event_presenter_obj(
|
||||
event_presenter_id=event_presenter_id,
|
||||
enabled=enabled,
|
||||
limit=limit,
|
||||
inc_address=inc_address,
|
||||
inc_contact=inc_contact,
|
||||
inc_event_abstract_list=inc_event_abstract_list,
|
||||
inc_event_badge=inc_event_badge,
|
||||
inc_event_device_list=inc_event_device_list,
|
||||
|
||||
@@ -208,26 +208,6 @@ async def get_event_session_obj_li(
|
||||
return mk_resp(data=False, status_code=404)
|
||||
|
||||
|
||||
@router.get('/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def get_event_session_obj(
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
obj_type = 'event_session'
|
||||
result = get_obj_template(
|
||||
obj_type=obj_type,
|
||||
obj_id=obj_id,
|
||||
by_alias=True,
|
||||
exclude_unset=True,
|
||||
)
|
||||
return result
|
||||
|
||||
|
||||
# ### BEGIN ### API Event Session ### get_event_session_obj() ###
|
||||
# Working well as of 2021-06-04. Using as a template for other routes.
|
||||
@router.get('/{event_session_id}', response_model=Resp_Body_Base)
|
||||
@@ -235,11 +215,14 @@ async def get_event_session_obj(
|
||||
event_session_id: str = Query(..., min_length=1, max_length=22),
|
||||
enabled: str = 'enabled', # For now this covers any included objects or object lists
|
||||
limit: int = 500, # For now this covers any included objects or object lists
|
||||
inc_address: bool = False, # Under contact
|
||||
inc_contact: bool = False, # Under person
|
||||
inc_event_abstract_list: bool = False,
|
||||
inc_event_badge_list: bool = False,
|
||||
inc_event_device_list: bool = False,
|
||||
inc_event_file_list: bool = False,
|
||||
inc_event_location: bool = False,
|
||||
inc_event_person: bool = False, # Under event_presenter
|
||||
inc_event_person_list: bool = False,
|
||||
inc_event_presentation_list: bool = False,
|
||||
inc_event_presenter_cat: bool = False,
|
||||
@@ -247,6 +230,8 @@ async def get_event_session_obj(
|
||||
inc_event_registration_list: bool = False,
|
||||
inc_event_track: bool = False,
|
||||
inc_poc_event_person: bool = False,
|
||||
inc_person: bool = False, # Under event_person
|
||||
inc_user: bool = False, # Under event_person
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
@@ -262,11 +247,14 @@ async def get_event_session_obj(
|
||||
event_session_id=event_session_id,
|
||||
enabled=enabled,
|
||||
limit=limit,
|
||||
inc_address=inc_address,
|
||||
inc_contact=inc_contact,
|
||||
inc_event_abstract_list=inc_event_abstract_list,
|
||||
inc_event_badge_list=inc_event_badge_list,
|
||||
inc_event_device_list=inc_event_device_list,
|
||||
inc_event_file_list=inc_event_file_list,
|
||||
inc_event_location=inc_event_location,
|
||||
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,
|
||||
@@ -274,13 +262,16 @@ async def get_event_session_obj(
|
||||
inc_event_registration_list=inc_event_registration_list,
|
||||
inc_event_track=inc_event_track,
|
||||
inc_poc_event_person=inc_poc_event_person,
|
||||
inc_person=inc_person,
|
||||
inc_user=inc_user,
|
||||
):
|
||||
# event_dict = event_session_obj.dict(by_alias=by_alias, exclude_unset=exclude_unset)
|
||||
event_session_dict = event_session_obj.dict(by_alias=by_alias, exclude_unset=exclude_unset)
|
||||
pass
|
||||
else:
|
||||
return mk_resp(data=False, status_code=400) # Bad Request
|
||||
|
||||
return mk_resp(data=event_session_obj)
|
||||
return mk_resp(data=event_session_dict)
|
||||
#return mk_resp(data=event_session_obj)
|
||||
# ### END ### API Event ### get_event_session_obj() ###
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user