Work on exhibit and tracking

This commit is contained in:
Scott Idem
2022-02-17 19:22:52 -05:00
parent 67f769329e
commit 1978718129
6 changed files with 16 additions and 7 deletions

View File

@@ -30,6 +30,7 @@ db = engine.connect()
# ### BEGIN ### Core Help CRUD ### sql_insert() ### # ### BEGIN ### Core Help CRUD ### sql_insert() ###
# NOTE: Possible future change... Try to look up a duplicate entry if there is one on INSERT.
# Updated 2021-09-07 # Updated 2021-09-07
@logger_reset @logger_reset
def sql_insert( def sql_insert(

View File

@@ -466,7 +466,7 @@ def create_update_aether_person(
cvent_contact_obj: dict, cvent_contact_obj: dict,
account_id: str, account_id: str,
person_id: str=None, person_id: str=None,
log_lvl: int = logging.WARNING, # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL log_lvl: int = logging.INFO, # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
): ):
log.setLevel(log_lvl) log.setLevel(log_lvl)

View File

@@ -292,7 +292,7 @@ def load_person_obj(
inc_user: bool = False, inc_user: bool = False,
inc_user_role_list: bool = False, inc_user_role_list: bool = False,
) -> Person_Base|dict|bool: ) -> Person_Base|dict|bool:
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals()) log.debug(locals())
if person_id := redis_lookup_id_random(record_id_random=person_id, table_name='person'): pass if person_id := redis_lookup_id_random(record_id_random=person_id, table_name='person'): pass

View File

@@ -40,7 +40,7 @@ class Event_Exhibit_Tracking_Base(BaseModel):
enable: Optional[bool] enable: Optional[bool]
hide: Optional[bool] hide: Optional[bool]
priority: Optional[bool] priority: Optional[bool] = False
sort: Optional[int] sort: Optional[int]
group: Optional[str] group: Optional[str]

View File

@@ -109,7 +109,7 @@ async def get_event_exhibit_obj(
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals()) log.debug(locals())
# time.sleep(1) # time.sleep(.5)
# ### SECTION ### Secondary data validation # ### SECTION ### Secondary data validation
event_exhibit_id_random = event_exhibit_id # This is used later for the response data event_exhibit_id_random = event_exhibit_id # This is used later for the response data

View File

@@ -1,4 +1,4 @@
import datetime import datetime, time
from fastapi import APIRouter, Body, Depends, Header, HTTPException, Query, Response, status from fastapi import APIRouter, Body, Depends, Header, HTTPException, Query, Response, status
from pydantic import BaseModel, EmailStr, Field from pydantic import BaseModel, EmailStr, Field
from typing import Dict, List, Optional, Set, Union from typing import Dict, List, Optional, Set, Union
@@ -34,9 +34,11 @@ async def post_event_exhibit_tracking_obj(
commons: Common_Route_Params = Depends(common_route_params), commons: Common_Route_Params = Depends(common_route_params),
): ):
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals()) log.debug(locals())
# time.sleep(1)
# ### SECTION ### Secondary data validation # ### SECTION ### Secondary data validation
if event_exhibit_id := redis_lookup_id_random(record_id_random=event_exhibit_id, table_name='event_exhibit'): pass if event_exhibit_id := redis_lookup_id_random(record_id_random=event_exhibit_id, table_name='event_exhibit'): pass
# elif event_exhibit_id is None: pass # elif event_exhibit_id is None: pass
@@ -61,7 +63,13 @@ async def post_event_exhibit_tracking_obj(
event_person_id = event_person_id, event_person_id = event_person_id,
): pass ): pass
elif event_exhibit_tracking_id is None: elif event_exhibit_tracking_id is None:
return mk_resp(data=None, status_code=200, response=commons.response, status_message='Not created. Likely duplicate entry. Returning None.') # Success # NOTE: I think it makes sense to try and look up the record using the Exhibitor and Person ID. This is for API call convenience.
if event_exhibit_tracking_rec_li := get_event_exhibit_tracking_rec_list(event_exhibit_id=event_exhibit_id,event_person_id=event_person_id):
event_exhibit_tracking_rec = event_exhibit_tracking_rec_li[0]
event_exhibit_tracking_id = event_exhibit_tracking_rec.get('event_exhibit_tracking_id')
else:
log.warning('Should this be possible if there was an existing record? Assuming there is an existing record because the SQL function result was None.')
return mk_resp(data=None, status_code=200, response=commons.response, status_message='Not created. Likely duplicate entry. Returning None.') # Success
else: else:
log.warning('Likely bad request') log.warning('Likely bad request')
return mk_resp(data=False, status_code=400, response=commons.response, status_message='Not created. Something failed while processing the data. Check the field names and data types.') # Bad Request return mk_resp(data=False, status_code=400, response=commons.response, status_message='Not created. Something failed while processing the data. Check the field names and data types.') # Bad Request