From 916cca1d730aaf40cf624880c13cbb16c0fdfd9a Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Fri, 5 May 2023 17:29:02 -0400 Subject: [PATCH] Work on abstracts. --- app/models/data_store_models.py | 3 +++ app/models/event_abstract_models.py | 31 +++++++++++++++++++---------- app/routers/event_abstract.py | 10 +++++----- app/routers/event_person.py | 4 ++-- 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/app/models/data_store_models.py b/app/models/data_store_models.py index ed90df2..f82b165 100644 --- a/app/models/data_store_models.py +++ b/app/models/data_store_models.py @@ -41,6 +41,9 @@ class Data_Store_Base(BaseModel): description: Optional[str] # json: Optional[str] # "json" is reserved; need to change field name? json_str? + json_str: Optional[Union[Json, None]] = Field( + alias = 'json', + ) text: Optional[str] meta_json: Optional[str] meta_text: Optional[str] diff --git a/app/models/event_abstract_models.py b/app/models/event_abstract_models.py index cd837cb..dcd6fd8 100644 --- a/app/models/event_abstract_models.py +++ b/app/models/event_abstract_models.py @@ -33,7 +33,7 @@ class Event_Abstract_Base(BaseModel): event_id_random: Optional[str] event_id: Optional[int] - event_person_id_random: Optional[str] + event_person_id_random: Optional[str] # This is the primary person/submitter event_person_id: Optional[int] event_presentation_id_random: Optional[str] @@ -48,15 +48,19 @@ class Event_Abstract_Base(BaseModel): # event_track_id_random: Optional[str] # event_track_id: Optional[int] - poc_event_person_id_random: Optional[str] # Maybe change this to primary_event_person? - poc_event_person_id: Optional[int] # Maybe change this to primary_event_person? + # poc_event_person_id_random: Optional[str] # Maybe change this to primary_event_person? + # poc_event_person_id: Optional[int] # Maybe change this to primary_event_person? + external_id: Optional[str] + grant_id: Optional[str] code: Optional[str] name: Optional[str] description: Optional[str] abstract: Optional[str] + passcode: Optional[str] # = '7777777' + data_json: Optional[Json] enable: Optional[bool] @@ -127,14 +131,14 @@ class Event_Abstract_Base(BaseModel): return redis_lookup_id_random(record_id_random=id_random, table_name='event_session') return None - @validator('poc_event_person_id', always=True) - def poc_event_person_id_lookup(cls, v, values, **kwargs): - log.setLevel(logging.WARNING) - log.debug(locals()) + # @validator('poc_event_person_id', always=True) + # def poc_event_person_id_lookup(cls, v, values, **kwargs): + # log.setLevel(logging.WARNING) + # log.debug(locals()) - if values['poc_event_person_id_random']: - return redis_lookup_id_random(record_id_random=values['poc_event_person_id_random'], table_name='poc_event_person') - return None + # if values['poc_event_person_id_random']: + # return redis_lookup_id_random(record_id_random=values['poc_event_person_id_random'], table_name='poc_event_person') + # return None class Config: underscore_attrs_are_private = True @@ -173,11 +177,16 @@ class Event_Abstract_Base_New(Core_Std_Obj_Base): # event_track_id_random: Optional[str] - poc_event_person_id_random: Optional[str] # Maybe change this to primary_event_person? + # poc_event_person_id_random: Optional[str] # Maybe change this to primary_event_person? + + external_id: Optional[str] + grant_id: Optional[str] description: Optional[str] abstract: Optional[str] + passcode: Optional[str] + class Config: underscore_attrs_are_private = True allow_population_by_field_name = True diff --git a/app/routers/event_abstract.py b/app/routers/event_abstract.py index 10bace4..714bdd5 100644 --- a/app/routers/event_abstract.py +++ b/app/routers/event_abstract.py @@ -29,7 +29,7 @@ async def post_event_abstract_obj( # create_sub_obj: bool = False, # fail_any: bool = True, # Fail if any thing goes wrong for sub objects - return_obj: bool = True, + return_obj: bool = False, inc_event_file_list: bool = False, inc_event_person: bool = False, inc_event_presentation_list: bool = False, @@ -49,8 +49,8 @@ async def post_event_abstract_obj( # There should probably be a check for the event ID before calling the create function? if create_event_abstract_obj_result := create_update_event_abstract_obj( event_abstract_obj = event_abstract_obj, - event_id = event_abstract_obj.event_id, - event_person_id = event_abstract_obj.event_person_id, + event_id = event_id, # event_abstract_obj.event_id, + event_person_id = event_person_id, # event_abstract_obj.event_person_id, # create_sub_obj = create_sub_obj, # fail_any = fail_any, return_outline = False, @@ -193,7 +193,7 @@ async def get_event_abstract_obj( # ### END ### API Event Abstract ### get_event_abstract_obj() ### -# ### BEGIN ### API Event Exhibit Tracking ### delete_event_abstract_obj() ### +# ### BEGIN ### API Event Abstract ### delete_event_abstract_obj() ### # Updated 2023-03-22 @router.delete('/event/abstract/{event_abstract_id}', response_model=Resp_Body_Base) def delete_event_abstract_obj( @@ -222,4 +222,4 @@ def delete_event_abstract_obj( else: log.warning('Likely bad request') return mk_resp(data=False, status_code=400, response=response) # Bad Request -# ### END ### API Event Exhibit Tracking ### delete_event_abstract_obj() ### \ No newline at end of file +# ### END ### API Event Abstract ### delete_event_abstract_obj() ### \ No newline at end of file diff --git a/app/routers/event_person.py b/app/routers/event_person.py index e686bc1..e4e88c6 100644 --- a/app/routers/event_person.py +++ b/app/routers/event_person.py @@ -38,14 +38,14 @@ async def v4_post_event_person_obj_new( inc_user: bool = False, x_account_id: str = Header(...), - return_obj: bool = True, + return_obj: bool = False, # Should this default to False??? -2023-05-05 limit: int = 500, enabled: str = 'enabled', by_alias: bool = True, exclude_unset: bool = True, response: Response = Response, ): - log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL + log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL log.debug(locals()) # There should probably be a check for the event ID before calling the create function?