diff --git a/app/methods/event_presentation_methods.py b/app/methods/event_presentation_methods.py index a516062..08e2027 100644 --- a/app/methods/event_presentation_methods.py +++ b/app/methods/event_presentation_methods.py @@ -43,6 +43,7 @@ def load_event_presentation_obj( inc_event_registration: bool = False, #inc_event_registration_list: bool = False, inc_event_session: bool = False, + inc_hosted_file: bool = False, inc_person: bool = False, inc_user: bool = False, limit: int = 1000, @@ -85,7 +86,43 @@ def load_event_presentation_obj( if inc_event_abstract_list: pass # if inc_event_badge_list: pass if inc_event_device_list: pass - if inc_event_file_list: pass + + # Updated 2021-11-05 + if inc_event_file_list: + log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL + log.info('Need to include event file list...') + + from app.methods.event_file_methods import get_event_file_rec_list, load_event_file_obj + if event_file_rec_list_result := get_event_file_rec_list( + for_type = 'event_presentation', + for_id = event_presentation_id, + file_purpose_id = event_file_file_purpose_id, + file_purpose = event_file_file_purpose, + priority = event_file_priority, + group = event_file_group, + enabled = enabled, + limit = limit, + ): + event_file_result_list = [] + for event_file_rec in event_file_rec_list_result: + if load_event_file_result := load_event_file_obj( + event_file_id = event_file_rec.get('event_file_id', None), + enabled = enabled, + inc_hosted_file = inc_hosted_file, + # model_as_dict = True, + # by_alias = by_alias, + # exclude_unset = False, + ): + event_file_result_list.append(load_event_file_result) + else: + event_file_result_list.append(None) + log.debug(event_file_result_list) + event_presentation_obj.event_file_list = event_file_result_list + elif isinstance(event_file_rec_list_result, list): + event_presentation_obj.event_file_list = [] + else: + event_presentation_obj.event_file_list = None + if inc_event_person_list: pass if inc_event_presenter_list: diff --git a/app/routers/event_presenter.py b/app/routers/event_presenter.py index cd0cdf5..2ca3b5c 100644 --- a/app/routers/event_presenter.py +++ b/app/routers/event_presenter.py @@ -233,7 +233,7 @@ async def get_event_presenter_obj_li( # Working well as of 2021-06-07. Using as a template for other routes. @router.get('/{event_presenter_id}', response_model=Resp_Body_Base) async def get_event_presenter_obj( - event_presenter_id: str = Query(..., min_length=1, max_length=22), + event_presenter_id: str = Query(..., min_length=11, max_length=22), enabled: str = 'enabled', # enabled, disabled, all; For now this covers any included objects or object lists hidden: str = 'not_hidden', # hidden, not_hidden, all inc_file_count: bool = False, @@ -288,7 +288,7 @@ async def get_event_presenter_obj( event_presenter_dict = event_presenter_obj.dict(by_alias=by_alias, exclude_unset=exclude_unset) pass else: - return mk_resp(data=False, status_code=400, response=response) # Bad Request + return mk_resp(data=False, status_code=404, response=response) # Not Found return mk_resp(data=event_presenter_dict, response=response) #return mk_resp(data=event_presenter_obj, response=response) diff --git a/app/routers/hosted_file.py b/app/routers/hosted_file.py index ff156e6..256e62f 100644 --- a/app/routers/hosted_file.py +++ b/app/routers/hosted_file.py @@ -168,7 +168,7 @@ async def upload_files_fake( exclude_unset: 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()) log.debug(file_info_li)