Work on event person tracking and related
This commit is contained in:
@@ -82,6 +82,7 @@ def get_event_person_tracking_rec_list(
|
||||
event_id: int|str = None,
|
||||
event_person_id: int|str = None,
|
||||
event_session_id: int|str = None,
|
||||
in_out_type: str = None,
|
||||
# for_obj_type: str, # NOTE: This is not for_type because the field name generated based
|
||||
# for_obj_id: str, # NOTE: This is not for_id because the field name generated based
|
||||
enabled: str = 'enabled', # enabled, disabled, all
|
||||
@@ -127,6 +128,17 @@ def get_event_person_tracking_rec_list(
|
||||
if event_id or event_person_id or event_session_id: pass
|
||||
else: return False
|
||||
|
||||
if in_out_type:
|
||||
if in_out_type == 'check':
|
||||
sql_select_in_out_type = f'AND `event_person_tracking`.check_in_out = 1'
|
||||
elif in_out_type == 'break':
|
||||
sql_select_in_out_type = f'AND `event_person_tracking`.break_in_out = 1'
|
||||
else:
|
||||
data['other_type'] = in_out_type
|
||||
sql_select_in_out_type = f'AND `event_person_tracking`.other_in_out = 1 AND `event_person_tracking`.other_type = :other_type'
|
||||
else:
|
||||
sql_select_in_out_type = f''
|
||||
|
||||
# if for_obj_id := redis_lookup_id_random(record_id_random=for_obj_id, table_name=for_obj_type): pass
|
||||
# else: return False
|
||||
|
||||
@@ -159,6 +171,7 @@ def get_event_person_tracking_rec_list(
|
||||
{sql_select_event_person_id}
|
||||
{sql_select_event_session_id}
|
||||
{sql_enabled}
|
||||
{sql_select_in_out_type}
|
||||
ORDER BY `event_person_tracking`.created_on DESC, `event_person_tracking`.updated_on DESC
|
||||
{sql_limit};
|
||||
"""
|
||||
|
||||
@@ -95,6 +95,7 @@ class Event_Badge_Base(BaseModel):
|
||||
priority: Optional[bool]
|
||||
sort: Optional[int]
|
||||
group: Optional[str]
|
||||
enable: Optional[bool]
|
||||
|
||||
notes: Optional[str]
|
||||
created_on: Optional[datetime.datetime] = None
|
||||
|
||||
@@ -58,6 +58,7 @@ class Event_Person_Base(BaseModel):
|
||||
priority: Optional[bool]
|
||||
sort: Optional[int]
|
||||
group: Optional[str]
|
||||
enable: Optional[bool]
|
||||
|
||||
notes: Optional[str]
|
||||
created_on: Optional[datetime.datetime] = None
|
||||
|
||||
@@ -40,7 +40,7 @@ class Event_Person_Tracking_Base(BaseModel):
|
||||
other_in_out: Optional[bool]
|
||||
other_type: Optional[str] # For unknown client specific tracking (lunch, medical, pause, etc)
|
||||
|
||||
in_datetime: datetime.datetime # This should generally default to the created datetime and be overridden as needed
|
||||
in_datetime: Optional[datetime.datetime] # This should generally default to the created datetime and be overridden as needed
|
||||
out_datetime: Optional[datetime.datetime] # This should generally default to the updated datetime and be overridden as needed
|
||||
|
||||
# Maybe add minutes or hours?
|
||||
@@ -51,8 +51,9 @@ class Event_Person_Tracking_Base(BaseModel):
|
||||
break_out: Optional[bool] # Does this make sense to use instead?
|
||||
break_in: Optional[bool] # Does this make sense to use instead?
|
||||
check_out: Optional[bool] # Does this make sense to use instead?
|
||||
datetime: datetime.datetime # This should generally default to the created datetime and be overridden as needed
|
||||
datetime: Optional[datetime.datetime] # This should generally default to the created datetime and be overridden as needed
|
||||
|
||||
enable: Optional[bool]
|
||||
|
||||
notes: Optional[str]
|
||||
created_on: Optional[datetime.datetime] = None
|
||||
|
||||
@@ -89,6 +89,8 @@ class Person_Base(BaseModel):
|
||||
external_id: Optional[str]
|
||||
external_import_id: Optional[str]
|
||||
|
||||
enable: Optional[bool]
|
||||
|
||||
notes: Optional[str]
|
||||
|
||||
created_on: Optional[datetime.datetime] = None
|
||||
|
||||
@@ -25,6 +25,7 @@ from app.models.event_exhibit_models import *
|
||||
from app.models.event_file_models import *
|
||||
from app.models.event_location_models import *
|
||||
from app.models.event_person_models import *
|
||||
from app.models.event_person_tracking_models import *
|
||||
from app.models.event_presentation_models import *
|
||||
from app.models.event_presenter_models import *
|
||||
from app.models.event_registration_models import *
|
||||
@@ -81,6 +82,7 @@ obj_type_li['event_exhibit'] = {'table_name': 'v_event_exhibit', 'base_name': Ev
|
||||
obj_type_li['event_file'] = {'table_name': 'v_event_file', 'base_name': Event_File_Base} # Should this eventually be changed to event_hosted_file
|
||||
obj_type_li['event_location'] = {'table_name': 'v_event_location', 'base_name': Event_Location_Base}
|
||||
obj_type_li['event_person'] = {'table_name': 'v_event_person', 'base_name': Event_Person_Base}
|
||||
obj_type_li['event_person_tracking'] = {'table_name': 'v_event_person_tracking', 'base_name': Event_Person_Tracking_Base}
|
||||
obj_type_li['event_presentation'] = {'table_name': 'v_event_presentation', 'base_name': Event_Presentation_Base}
|
||||
obj_type_li['event_presenter'] = {'table_name': 'v_event_presenter', 'base_name': Event_Presenter_Base}
|
||||
obj_type_li['event_registration'] = {'table_name': 'v_event_registration', 'base_name': Event_Registration_Base}
|
||||
|
||||
@@ -22,7 +22,7 @@ router = APIRouter()
|
||||
|
||||
@router.post('/event/person/tracking', response_model=Resp_Body_Base)
|
||||
async def post_event_person_tracking_obj(
|
||||
obj: Event_Person_Tracking_Base,
|
||||
event_person_tracking_obj: Event_Person_Tracking_Base,
|
||||
x_account_id: str = Header(...),
|
||||
return_obj: Optional[bool] = True,
|
||||
by_alias: Optional[bool] = True,
|
||||
@@ -33,10 +33,10 @@ async def post_event_person_tracking_obj(
|
||||
log.debug(locals())
|
||||
|
||||
obj_type = 'event_person_tracking'
|
||||
obj_data_dict = obj.dict(by_alias=False, exclude_unset=True)
|
||||
event_person_tracking_obj_data_dict = event_person_tracking_obj.dict(by_alias=False, exclude_unset=True)
|
||||
result = post_obj_template(
|
||||
obj_type = obj_type,
|
||||
data=obj_data_dict,
|
||||
data = event_person_tracking_obj_data_dict,
|
||||
return_obj = True,
|
||||
by_alias = True,
|
||||
exclude_unset = True,
|
||||
@@ -44,10 +44,10 @@ async def post_event_person_tracking_obj(
|
||||
return result
|
||||
|
||||
|
||||
@router.patch('/event/person/tracking/{obj_id}', response_model=Resp_Body_Base)
|
||||
@router.patch('/event/person/tracking/{event_person_tracking_id}', response_model=Resp_Body_Base)
|
||||
async def patch_event_person_tracking_obj(
|
||||
obj: Event_Person_Tracking_Base,
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
event_person_tracking_obj: Event_Person_Tracking_Base,
|
||||
event_person_tracking_id: str = Query(..., min_length=1, max_length=22),
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
by_alias: Optional[bool] = True,
|
||||
@@ -58,13 +58,13 @@ async def patch_event_person_tracking_obj(
|
||||
log.debug(locals())
|
||||
|
||||
obj_type = 'event_person_tracking'
|
||||
obj_data_dict = obj.dict(by_alias=False, exclude_unset=True)
|
||||
obj_data_dict['id'] = redis_lookup_id_random(record_id_random=obj_id, table_name=obj_type)
|
||||
obj_data_dict['id_random'] = obj_id
|
||||
event_person_tracking_obj_data_dict = event_person_tracking_obj.dict(by_alias=False, exclude_unset=True)
|
||||
event_person_tracking_obj_data_dict['id'] = redis_lookup_id_random(record_id_random=event_person_tracking_id, table_name=obj_type)
|
||||
event_person_tracking_obj_data_dict['id_random'] = event_person_tracking_id
|
||||
result = patch_obj_template(
|
||||
obj_type = obj_type,
|
||||
data=obj_data_dict,
|
||||
obj_id=obj_id,
|
||||
data = event_person_tracking_obj_data_dict,
|
||||
obj_id = event_person_tracking_id,
|
||||
return_obj = True,
|
||||
by_alias = True,
|
||||
exclude_unset = True,
|
||||
@@ -122,6 +122,7 @@ async def get_event_person_tracking_obj(
|
||||
async def get_event_person_obj_tracking_list(
|
||||
event_person_id: str = Query(..., min_length=11, max_length=22),
|
||||
event_session_id: str = Query(None, min_length=11, max_length=22),
|
||||
in_out_type: str = Query(None, min_length=1, max_length=15),
|
||||
limit: int = 500, # For now this covers any included objects or object lists
|
||||
enabled: str = 'enabled', # For now this covers any included objects or object lists
|
||||
inc_event_person: bool = False,
|
||||
@@ -146,6 +147,7 @@ async def get_event_person_obj_tracking_list(
|
||||
account_id = x_account_id,
|
||||
event_person_id = event_person_id,
|
||||
event_session_id = event_session_id,
|
||||
in_out_type = in_out_type,
|
||||
enabled = enabled,
|
||||
limit = limit,
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user