Code clean up. Work on event session and file counts for event models

This commit is contained in:
Scott Idem
2021-09-28 18:06:35 -04:00
parent fb7efa9930
commit e231090168
10 changed files with 79 additions and 11 deletions

View File

@@ -462,10 +462,10 @@ async def get_event_session_obj_li(
# ### BEGIN ### API Event Session ### get_event_session_obj() ###
# Working well as of 2021-06-04. Using as a template for other routes.
# Updated 2021-09-28
@router.get('/event/session/{event_session_id}', response_model=Resp_Body_Base)
async def get_event_session_obj(
event_session_id: str = Query(..., min_length=1, max_length=22),
event_session_id: str = Query(..., min_length=11, 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
@@ -486,21 +486,28 @@ async def get_event_session_obj(
inc_poc_event_person: bool = False,
inc_person: bool = False, # Under event_person
inc_user: bool = False, # Under event_person
review: str = 'ready', # ready, not_ready, all
approved: str = 'approved', # approved, not_approved, all
hidden: str = 'not_hidden', # hidden, not_hidden, all
inc_file_count: bool = False, # NOTE: file counts are from separate views
x_account_id: str = Header(...),
by_alias: Optional[bool] = True,
exclude_unset: Optional[bool] = True,
response: Response = Response,
):
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
if event_session_id := redis_lookup_id_random(record_id_random=event_session_id, table_name='event_session'): pass
else:
return mk_resp(data=None, status_code=404, response=response)
else: return mk_resp(data=None, status_code=404, response=response)
if event_session_obj := load_event_session_obj(
event_session_id = event_session_id,
enabled = enabled,
# review = review,
# approved = approved,
hidden = hidden,
inc_file_count = inc_file_count,
limit = limit,
inc_address = inc_address,
inc_contact = inc_contact,
@@ -550,6 +557,8 @@ async def get_event_event_session_obj_li(
inc_poc_event_person: bool = False,
review: str = 'ready', # ready, not_ready, all
approved: str = 'approved', # approved, not_approved, all
hidden: str = 'not_hidden', # hidden, not_hidden, all
inc_file_count: bool = False, # NOTE: file counts are from separate views
x_account_id: str = Header(...),
by_alias: Optional[bool] = True,
exclude_unset: Optional[bool] = True,
@@ -566,6 +575,7 @@ async def get_event_event_session_obj_li(
event_id = event_id,
review = review, # ready, not_ready, all
approved = approved, # approve(d), not_approved, all
hidden = hidden, # hidden, not_hidden, all
enabled = enabled,
limit = limit,
):
@@ -574,6 +584,10 @@ async def get_event_event_session_obj_li(
if load_event_session_result := load_event_session_obj(
event_session_id = event_session_rec.get('event_session_id', None),
enabled = enabled,
# review = review,
# approved = approved,
hidden = hidden,
inc_file_count = inc_file_count,
limit = limit,
inc_event_file_list = inc_event_file_list,
inc_event_presentation_list = inc_event_presentation_list,