A lot of work on event related modules

This commit is contained in:
Scott Idem
2021-06-04 16:01:23 -04:00
parent 735e50dc0f
commit 627bc8c4df
10 changed files with 554 additions and 200 deletions

View File

@@ -211,24 +211,80 @@ async def get_event_obj_li(
return mk_resp(data=False, status_code=404)
@router.get('/{obj_id}', response_model=Resp_Body_Base)
# ### BEGIN ### API Event ### get_event_obj() ###
# Working well as of 2021-06-04. Using as a template for other routes.
@router.get('/{event_id}', response_model=Resp_Body_Base)
async def get_event_obj(
obj_id: str = Query(..., min_length=1, max_length=22),
event_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_contact_1: bool = False,
inc_contact_2: bool = False,
inc_contact_3: bool = False,
inc_event_abstract_list: bool = False,
inc_event_badge_list: bool = False,
inc_event_device_list: bool = False,
inc_event_exhibit_list: bool = False,
inc_event_file_list: bool = False,
inc_event_location: bool = False,
inc_event_location_list: bool = False,
inc_event_person_list: bool = False,
inc_event_presentation_list: bool = False,
inc_event_presenter_cat: bool = False,
inc_event_presenter_list: bool = False,
inc_event_registration_list: bool = False,
inc_event_session_list: bool = False,
inc_event_track: bool = False,
inc_event_track_list: bool = False,
inc_event_cfg: bool = False,
inc_event_registration_cfg: bool = False,
inc_location_address: bool = False,
inc_poc_event_person: bool = False,
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.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
obj_type = 'event'
result = get_obj_template(
obj_type=obj_type,
obj_id=obj_id,
by_alias=True,
exclude_unset=True,
)
return result
if event_id := redis_lookup_id_random(record_id_random=event_id, table_name='event'): pass
else:
return mk_resp(data=None, status_code=404)
if event_obj := load_event_obj(
event_id=event_id,
enabled=enabled,
limit=limit,
inc_contact_1=inc_contact_1,
inc_contact_2=inc_contact_2,
inc_contact_3=inc_contact_3,
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_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_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_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_event_cfg=inc_event_cfg,
inc_event_registration_cfg=inc_event_registration_cfg,
inc_location_address=inc_location_address,
inc_poc_event_person=inc_poc_event_person,
):
# event_dict = event_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_obj)
# ### END ### API Event ### get_event_obj() ###
@router.delete('/{obj_id}', response_model=Resp_Body_Base)