From 43a9fe7fe55a59a2ba3ad6cc606e11d52fc891cf Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Thu, 13 Apr 2023 18:27:56 -0400 Subject: [PATCH] Moving away sql_insert function creating IDs automatically. Only if asked. --- app/methods/e_confex_methods.py | 2 +- app/routers/api_crud.py | 3 ++- app/routers/event_badge.py | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/methods/e_confex_methods.py b/app/methods/e_confex_methods.py index e42e1dc..55e306a 100644 --- a/app/methods/e_confex_methods.py +++ b/app/methods/e_confex_methods.py @@ -230,7 +230,7 @@ def get_event_presenter_detail( confex_presentation_id: str, # similar to 'Paper/99999' confex_presenter_id: str, # similar to 'Person/99999' ): - log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL + log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL log.debug(locals()) # if result := authenticate(): diff --git a/app/routers/api_crud.py b/app/routers/api_crud.py index a851313..27aeeb2 100644 --- a/app/routers/api_crud.py +++ b/app/routers/api_crud.py @@ -528,6 +528,7 @@ async def delete_obj( def post_obj_template( obj_type: str, data: dict, + id_random_length: int = 8, # Added 2023-04-13; need to move away from this return_obj: bool=True, by_alias: bool=True, include: Optional[list] = [], @@ -545,7 +546,7 @@ def post_obj_template( table_name_select = obj_type_li[obj_type]['table_name'] base_name = obj_type_li[obj_type]['base_name'] - if sql_insert_result := sql_insert(table_name=table_name_insert, data=obj_data): + if sql_insert_result := sql_insert(table_name=table_name_insert, data=obj_data, id_random_length=id_random_length): log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL log.debug(sql_insert_result) obj_id = sql_insert_result diff --git a/app/routers/event_badge.py b/app/routers/event_badge.py index cf3baf4..9c78195 100644 --- a/app/routers/event_badge.py +++ b/app/routers/event_badge.py @@ -36,6 +36,7 @@ async def post_event_badge_obj( result = post_obj_template( obj_type = obj_type, data = obj_data_dict, + id_random_length = 0, # Added 2023-04-13; need to let SQL take care of this return_obj = True, by_alias = True, exclude_unset = True,