Working on event (meet) and related updates

This commit is contained in:
Scott Idem
2021-06-30 15:47:31 -04:00
parent 830b9ee608
commit 59c151f639
8 changed files with 367 additions and 102 deletions

View File

@@ -7,6 +7,8 @@ from pydantic import BaseModel, EmailStr, Field, PrivateAttr, ValidationError, v
from app.db_sql import redis_lookup_id_random, sql_insert, sql_select, sql_update from app.db_sql import redis_lookup_id_random, sql_insert, sql_select, sql_update
from app.lib_general import log, logging from app.lib_general import log, logging
from app.methods.address_methods import load_address_obj
from app.methods.contact_methods import load_contact_obj
from app.methods.event_session_methods import load_event_session_obj from app.methods.event_session_methods import load_event_session_obj
from app.methods.person_methods import create_person_obj, load_person_obj, update_person_obj from app.methods.person_methods import create_person_obj, load_person_obj, update_person_obj
from app.methods.user_methods import create_user_obj, load_user_obj, update_user_obj from app.methods.user_methods import create_user_obj, load_user_obj, update_user_obj
@@ -17,12 +19,17 @@ from app.models.event_models import Event_Base, Event_Cfg_Base
# ### BEGIN ### API Event Methods ### load_event_obj() ### # ### BEGIN ### API Event Methods ### load_event_obj() ###
def load_event_obj( def load_event_obj(
event_id: int|str, event_id: int|str,
model_as_dict: bool = False,
limit: int = 1000, limit: int = 1000,
by_alias: bool = True,
exclude_unset: bool = True,
model_as_dict: bool = False,
enabled: str = 'enabled', # enabled, disabled, all enabled: str = 'enabled', # enabled, disabled, all
inc_contact_1: bool = False, inc_address: bool = False, # Under contact
inc_contact_2: bool = False, # inc_address_location: bool = False,
inc_contact_3: bool = False, inc_contact: bool = False,
# inc_contact_1: bool = False,
# inc_contact_2: bool = False,
# inc_contact_3: bool = False,
inc_event_abstract_list: bool = False, inc_event_abstract_list: bool = False,
inc_event_badge_list: bool = False, inc_event_badge_list: bool = False,
inc_event_cfg: bool = False, inc_event_cfg: bool = False,
@@ -40,9 +47,12 @@ def load_event_obj(
inc_event_session_list: bool = False, inc_event_session_list: bool = False,
inc_event_track: bool = False, # For event_session child object inc_event_track: bool = False, # For event_session child object
inc_event_track_list: bool = False, inc_event_track_list: bool = False,
inc_location_address: bool = False, inc_order_list: bool = False,
inc_poc_event_person: bool = False, inc_organization: bool = False,
inc_person: bool = False, inc_person: bool = False,
inc_poc_event_person: bool = False,
inc_product: bool = False,
inc_product_list: bool = False,
inc_user: bool = False, inc_user: bool = False,
) -> Event_Base|bool: ) -> Event_Base|bool:
#log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL #log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
@@ -70,19 +80,81 @@ def load_event_obj(
poc_person_id = event_rec.get('poc_person_id', None) poc_person_id = event_rec.get('poc_person_id', None)
user_id = event_rec.get('user_id', None) user_id = event_rec.get('user_id', None)
# Updated 2021-06-30
if inc_address: # This address is directly linked from the event record.
address_location_id = event_rec.get('address_location_id', None)
log.debug(address_location_id)
if address_location_result := load_address_obj(
address_id = address_location_id,
limit = limit,
by_alias = by_alias,
exclude_unset = exclude_unset,
model_as_dict = model_as_dict,
enabled = enabled,
):
event_obj.address_location = address_location_result
else: event_obj.address_location = None
# Updated 2021-06-30
if inc_contact: # Just load all 3 of the contacts
contact_1_id = event_rec.get('contact_1_id', None)
log.debug(contact_1_id)
if contact_1_result := load_contact_obj(
contact_id = contact_1_id,
limit = limit,
by_alias = by_alias,
exclude_unset = exclude_unset,
model_as_dict = model_as_dict,
enabled = enabled,
inc_address = inc_address,
):
event_obj.contact_1 = contact_1_result
else: event_obj.contact_1 = None
contact_2_id = event_rec.get('contact_2_id', None)
log.debug(contact_2_id)
if contact_2_result := load_contact_obj(
contact_id = contact_2_id,
limit = limit,
by_alias = by_alias,
exclude_unset = exclude_unset,
model_as_dict = model_as_dict,
enabled = enabled,
inc_address = inc_address,
):
event_obj.contact_2 = contact_2_result
else: event_obj.contact_2 = None
contact_3_id = event_rec.get('contact_3_id', None)
log.debug(contact_3_id)
if contact_3_result := load_contact_obj(
contact_id = contact_3_id,
limit = limit,
by_alias = by_alias,
exclude_unset = exclude_unset,
model_as_dict = model_as_dict,
enabled = enabled,
inc_address = inc_address,
):
event_obj.contact_3 = contact_3_result
else: event_obj.contact_3 = None
#if inc_event: pass #if inc_event: pass
if inc_event_abstract_list: pass if inc_event_abstract_list: pass
if inc_event_badge_list: pass if inc_event_badge_list: pass
if inc_event_cfg: # and event_cfg_id ??? # Updated 2021-06-30
#log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL if inc_event_cfg:
log.debug(event_id) # event_id = event_rec.get('event_id', None)
if event_cfg_obj := load_event_cfg_obj( # log.debug(event_id)
event_id=event_id, # event_cfg_id ??? if event_cfg_result := load_event_cfg_obj(
event_id = event_id,
by_alias = by_alias,
exclude_unset = exclude_unset,
model_as_dict = model_as_dict,
): ):
event_obj.event_cfg = event_cfg_obj.dict(by_alias=True, exclude_unset=True) event_obj.event_cfg = event_cfg_result
else: else: event_obj.event_cfg = None
event_obj.event_cfg = None
if inc_event_device_list: pass if inc_event_device_list: pass
if inc_event_exhibit_list: pass if inc_event_exhibit_list: pass
@@ -175,9 +247,75 @@ def load_event_obj(
# ### END ### API Event Methods ### load_event_obj() ### # ### END ### API Event Methods ### load_event_obj() ###
# ### BEGIN ### API Event Methods ### get_event_rec_list() ###
def get_event_rec_list(
for_obj_type: str,
for_obj_id: str,
limit: int = 1000,
enabled: str = 'enabled', # enabled, disabled, all
conference: bool = False,
) -> list|bool:
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
if for_obj_id := redis_lookup_id_random(record_id_random=for_obj_id, table_name='for_obj_type'): pass
else: return False
data = {}
data[f'{for_obj_type}_id'] = for_obj_id
# data['for_obj_type'] = for_obj_type
sql_obj_type_id = f'`tbl`.{for_obj_type}_id = :{for_obj_type}_id'
if enabled in ['enabled', 'disabled', 'all']:
if enabled == 'enabled':
data['enable'] = True
sql_enabled = f'AND `tbl`.enable = :enable'
elif enabled == 'disabled':
data['enable'] = False
sql_enabled = f'AND `tbl`.enable = :enable'
elif enabled == 'all':
sql_enabled = ''
if conference:
data['conference'] = True
sql_conference = f'AND `tbl`.conference = :conference'
else:
data['conference'] = False
sql_conference = f'AND `tbl`.conference = :conference'
if limit:
data['limit'] = limit
sql_limit = f'LIMIT :limit'
else:
sql_limit = ''
sql = f"""
SELECT `tbl`.id AS 'event_id', `tbl`.id_random AS 'event_id_random'
FROM `event` AS `tbl`
WHERE
{sql_obj_type_id}
{sql_enabled}
{sql_conference}
ORDER BY `tbl`.created_on DESC, `tbl`.updated_on DESC
{sql_limit};
"""
if event_rec_li_result := sql_select(data=data, sql=sql, as_list=True):
event_rec_li = event_rec_li_result
else:
event_rec_li = []
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(event_rec_li_result)
return event_rec_li
# ### END ### API Event Methods ### get_event_rec_list() ###
# ### BEGIN ### API Event Methods ### load_event_cfg_obj() ### # ### BEGIN ### API Event Methods ### load_event_cfg_obj() ###
def load_event_cfg_obj( def load_event_cfg_obj(
event_id: int|str, event_id: int|str,
limit: int = 1000,
by_alias: bool = True,
exclude_unset: bool = True,
model_as_dict: bool = False, model_as_dict: bool = False,
) -> Event_Cfg_Base|bool: ) -> Event_Cfg_Base|bool:
#log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL #log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
@@ -198,7 +336,10 @@ def load_event_cfg_obj(
return False return False
else: return False else: return False
return event_cfg_obj if model_as_dict:
return event_cfg_obj.dict(by_alias=by_alias, exclude_unset=exclude_unset) # pylint: disable=no-member
else:
return event_cfg_obj
# ### END ### API Event Methods ### load_event_cfg_obj() ### # ### END ### API Event Methods ### load_event_cfg_obj() ###
@@ -229,7 +370,7 @@ def load_event_obj_list(
inc_event_session_list: bool = False, inc_event_session_list: bool = False,
inc_event_track: bool = False, # For event_session child object inc_event_track: bool = False, # For event_session child object
inc_event_track_list: bool = False, inc_event_track_list: bool = False,
inc_location_address: bool = False, inc_address_location: bool = False,
inc_poc_event_person: bool = False, inc_poc_event_person: bool = False,
inc_person: bool = False, inc_person: bool = False,
inc_user: bool = False, inc_user: bool = False,
@@ -287,7 +428,7 @@ def load_event_obj_list(
limit = limit, limit = limit,
model_as_dict = model_as_dict, model_as_dict = model_as_dict,
enabled = enabled, enabled = enabled,
# inc_location_address = inc_address, # inc_address_location = inc_address,
# inc_contact_1 = inc_contact, # inc_contact_1 = inc_contact,
# inc_contact_2 = inc_contact, # inc_contact_2 = inc_contact,
# inc_contact_3 = inc_contact, # inc_contact_3 = inc_contact,
@@ -405,57 +546,3 @@ def update_event_obj(
log.debug(event_obj_up_result) log.debug(event_obj_up_result)
return False return False
# ### END ### API Event Methods ### update_event_obj() ### # ### END ### API Event Methods ### update_event_obj() ###
# ### BEGIN ### API Event Methods ### get_event_rec_list() ###
def get_event_rec_list(
for_obj_type: str,
for_obj_id: str,
limit: int = 1000,
enabled: str = 'enabled', # enabled, disabled, all
) -> list|bool:
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
if for_obj_id := redis_lookup_id_random(record_id_random=for_obj_id, table_name='for_obj_type'): pass
else: return False
data = {}
data[f'{for_obj_type}_id'] = for_obj_id
# data['for_obj_type'] = for_obj_type
sql_obj_type_id = f'`tbl`.{for_obj_type}_id = :{for_obj_type}_id'
if enabled in ['enabled', 'disabled', 'all']:
if enabled == 'enabled':
data['enable'] = True
sql_enabled = f'AND `tbl`.enable = :enable'
elif enabled == 'disabled':
data['enable'] = False
sql_enabled = f'AND `tbl`.enable = :enable'
elif enabled == 'all':
sql_enabled = ''
if limit:
data['limit'] = limit
sql_limit = f'LIMIT :limit'
else:
sql_limit = ''
sql = f"""
SELECT `tbl`.id AS 'event_id', `tbl`.id_random AS 'event_id_random'
FROM `event` AS `tbl`
WHERE
{sql_obj_type_id}
{sql_enabled}
ORDER BY `tbl`.created_on DESC, `tbl`.updated_on DESC
{sql_limit};
"""
if event_rec_li_result := sql_select(data=data, sql=sql, as_list=True):
event_rec_li = event_rec_li_result
else:
event_rec_li = []
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(event_rec_li_result)
return event_rec_li
# ### END ### API Event Methods ### get_event_rec_list() ###

View File

@@ -127,6 +127,7 @@ class Address_Base(BaseModel):
class Config: class Config:
underscore_attrs_are_private = True underscore_attrs_are_private = True
allow_population_by_field_name = True
fields = base_fields fields = base_fields
#Address_Base.update_forward_refs() #Address_Base.update_forward_refs()

View File

@@ -124,6 +124,7 @@ class Contact_Base(BaseModel):
class Config: class Config:
underscore_attrs_are_private = True underscore_attrs_are_private = True
allow_population_by_field_name = True
fields = base_fields fields = base_fields
#Contact_Base.update_forward_refs() #Contact_Base.update_forward_refs()

View File

@@ -42,9 +42,12 @@ class Event_Base(BaseModel):
lu_event_type_id: Optional[int] lu_event_type_id: Optional[int]
#lu_event_type: Optional[str] # Needs to be reviewed #lu_event_type: Optional[str] # Needs to be reviewed
type_name: Optional[str] = Field( conference: Optional[bool]
alias = 'type'
) # type_name: Optional[str] = Field(
# alias = 'type'
# )
type: Optional[str]
name: Optional[str] name: Optional[str]
summary: Optional[str] summary: Optional[str]
@@ -70,6 +73,7 @@ class Event_Base(BaseModel):
weekday_friday: Optional[bool] weekday_friday: Optional[bool]
weekday_saturday: Optional[bool] weekday_saturday: Optional[bool]
address_location_id_random: Optional[str]
address_location_id: Optional[int] address_location_id: Optional[int]
location_text: Optional[str] location_text: Optional[str]
@@ -87,6 +91,19 @@ class Event_Base(BaseModel):
physical: Optional[bool] # physical in person event physical: Optional[bool] # physical in person event
virtual: Optional[bool] # virtual remote access event virtual: Optional[bool] # virtual remote access event
contact_1_id_random: Optional[str]
contact_1_id: Optional[int]
contact_2_id_random: Optional[str]
contact_2_id: Optional[int]
contact_3_id_random: Optional[str]
contact_3_id: Optional[int]
attend_url: Optional[str]
attend_url_passcode: Optional[str]
attend_phone: Optional[str]
attend_phone_passcode: Optional[str]
attend_text: Optional[str]
# NOT FINISHED YET # NOT FINISHED YET
# access_key: Optional[str] # Maybe use in the future? # access_key: Optional[str] # Maybe use in the future?
@@ -182,6 +199,42 @@ class Event_Base(BaseModel):
return redis_lookup_id_random(record_id_random=values['user_id_random'], table_name='user') return redis_lookup_id_random(record_id_random=values['user_id_random'], table_name='user')
return None return None
@validator('address_location_id', always=True)
def address_location_id_lookup(cls, v, values, **kwargs):
log.setLevel(logging.WARNING)
log.debug(locals())
if values['address_location_id_random']:
return redis_lookup_id_random(record_id_random=values['address_location_id_random'], table_name='address')
return None
@validator('contact_1_id', always=True)
def contact_1_id_lookup(cls, v, values, **kwargs):
log.setLevel(logging.WARNING)
log.debug(locals())
if values['contact_1_id_random']:
return redis_lookup_id_random(record_id_random=values['contact_1_id_random'], table_name='contact')
return None
@validator('contact_2_id', always=True)
def contact_2_id_lookup(cls, v, values, **kwargs):
log.setLevel(logging.WARNING)
log.debug(locals())
if values['contact_2_id_random']:
return redis_lookup_id_random(record_id_random=values['contact_2_id_random'], table_name='contact')
return None
@validator('contact_3_id', always=True)
def contact_3_id_lookup(cls, v, values, **kwargs):
log.setLevel(logging.WARNING)
log.debug(locals())
if values['contact_3_id_random']:
return redis_lookup_id_random(record_id_random=values['contact_3_id_random'], table_name='contact')
return None
class Config: class Config:
underscore_attrs_are_private = True underscore_attrs_are_private = True
allow_population_by_field_name = True allow_population_by_field_name = True
@@ -285,4 +338,4 @@ class Event_Cfg_Base(BaseModel):
# return redis_lookup_id_random(record_id_random=values['id_random'], table_name='event') # return redis_lookup_id_random(record_id_random=values['id_random'], table_name='event')
# return None # return None
Event_Base.update_forward_refs() # NOTE: This is needed since Event_Cfg_Base is below Event_Base. Event_Base.update_forward_refs() # NOTE: This is needed since Event_Cfg_Base is below Event_Base.

View File

@@ -123,6 +123,7 @@ class Organization_Base(BaseModel):
class Config: class Config:
underscore_attrs_are_private = True underscore_attrs_are_private = True
allow_population_by_field_name = True
fields = base_fields fields = base_fields
#if TYPE_CHECKING: #if TYPE_CHECKING:

View File

@@ -11,6 +11,7 @@ from app.routers.api_crud import delete_obj_template, get_obj_template, get_obj_
from app.methods.account_methods import load_account_obj, load_account_obj_membership_type from app.methods.account_methods import load_account_obj, load_account_obj_membership_type
from app.methods.account_cfg_methods import load_account_cfg_obj from app.methods.account_cfg_methods import load_account_cfg_obj
from app.methods.event_methods import get_event_rec_list, load_event_obj
from app.methods.membership_group_methods import get_membership_group_rec_list, load_membership_group_obj from app.methods.membership_group_methods import get_membership_group_rec_list, load_membership_group_obj
from app.methods.membership_member_methods import get_membership_member_rec_list, load_membership_member_obj from app.methods.membership_member_methods import get_membership_member_rec_list, load_membership_member_obj
from app.methods.membership_type_methods import get_membership_type_rec_list, load_membership_type_obj from app.methods.membership_type_methods import get_membership_type_rec_list, load_membership_type_obj
@@ -276,6 +277,111 @@ async def get_account_obj_new(
# ### END ### API Account ### get_account_obj_new() ### # ### END ### API Account ### get_account_obj_new() ###
# ### BEGIN ### API Account ### get_account_obj_event_list() ###
# Working well as of 2021-06-30. Using as a template for other routes.
@router.get('/{account_id}/event_list', response_model=Resp_Body_Base)
async def get_account_obj_event_list(
account_id: str = Query(..., min_length=1, max_length=22),
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
conference: bool = False, # Events with badges, sessions, presentations, presenters, registration, etc
# inc_account_cfg: bool = False,
inc_address: bool = False, # Under event and under contact
# inc_address_location: bool = False,
inc_contact: bool = False,
# inc_event_abstract_list: bool = False,
# inc_event_badge_list: bool = False,
inc_event_cfg: bool = False,
# inc_event_device_list: bool = False,
# inc_event_exhibit_list: bool = False,
inc_event_file_list: bool = False,
# inc_event_location: bool = False,
inc_event_location_list: bool = False,
# inc_event_person: bool = False,
inc_event_person_list: bool = False,
inc_event_presentation_list: bool = False,
# inc_event_presenter_cat: bool = False,
inc_event_presenter_list: bool = False,
# inc_event_registration_cfg: bool = False,
# inc_event_registration_list: bool = False,
inc_event_session_list: bool = False,
# inc_event_track: bool = False,
# inc_event_track_list: bool = False,
# inc_order_list: bool = False,
inc_organization: bool = False,
inc_person: bool = False,
inc_poc_event_person: bool = False,
inc_product: bool = False,
inc_product_list: bool = False,
inc_user: bool = False,
x_account_id: str = Header(...),
by_alias: Optional[bool] = True,
exclude_unset: Optional[bool] = True,
):
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
if account_id := redis_lookup_id_random(record_id_random=account_id, table_name='account'): pass
else: return mk_resp(data=None, status_code=404)
response_data = None
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
# Updated 2021-06-30
if event_rec_list_result := get_event_rec_list(
for_obj_type = 'account',
for_obj_id = account_id,
limit = limit,
enabled = enabled,
conference = conference,
):
event_result_list = []
for event_rec in event_rec_list_result:
if load_event_result := load_event_obj(
event_id = event_rec.get('event_id', None),
limit = limit,
by_alias = by_alias,
exclude_unset = exclude_unset,
# model_as_dict = model_as_dict,
enabled = enabled,
inc_address = inc_address,
inc_contact = inc_contact,
# inc_event_abstract_list = inc_event_abstract_list,
# inc_event_badge_list = inc_event_badge_list,
inc_event_cfg = inc_event_cfg,
# inc_event_device_list = inc_event_device_list,
# inc_event_exhibit_list = inc_event_exhibit_list,
inc_event_file_list = inc_event_file_list,
# inc_event_location = inc_event_location,
inc_event_location_list = inc_event_location_list,
# inc_event_person = inc_event_person,
inc_event_person_list = inc_event_person_list,
inc_event_presentation_list = inc_event_presentation_list,
# inc_event_presenter_cat = inc_event_presenter_cat,
inc_event_presenter_list = inc_event_presenter_list,
# inc_event_registration_cfg = inc_event_registration_cfg,
# inc_event_registration_list = inc_event_registration_list,
inc_event_session_list = inc_event_session_list,
# inc_event_track = inc_event_track,
# inc_event_track_list = inc_event_track_list,
# inc_order_list = inc_order_list,
inc_organization = inc_organization,
inc_person = inc_person,
# inc_product = inc_product,
# inc_product_list = inc_product_list,
inc_user = inc_user,
):
event_result_list.append(load_event_result)
else:
event_result_list.append(None)
response_data = event_result_list
else:
return mk_resp(data=False, status_code=400) # Bad Request
return mk_resp(data=response_data)
# ### END ### API Account ### get_account_obj_event_list() ###
# ### BEGIN ### API Account ### get_account_obj_membership_member_list() ### # ### BEGIN ### API Account ### get_account_obj_membership_member_list() ###
# Working well as of 2021-06-24. Using as a template for other routes. # Working well as of 2021-06-24. Using as a template for other routes.
@router.get('/{account_id}/membership_member_list', response_model=Resp_Body_Base) @router.get('/{account_id}/membership_member_list', response_model=Resp_Body_Base)

View File

@@ -140,6 +140,7 @@ async def get_event_obj_li(
limit: int = None, limit: int = None,
inc_event_abstract_list: bool = False, inc_event_abstract_list: bool = False,
inc_event_badge_list: bool = False, inc_event_badge_list: bool = False,
inc_event_cfg: bool = False,
inc_event_device_list: bool = False, inc_event_device_list: bool = False,
inc_event_exhibit_list: bool = False, inc_event_exhibit_list: bool = False,
inc_event_file_list: bool = False, inc_event_file_list: bool = False,
@@ -147,11 +148,10 @@ async def get_event_obj_li(
inc_event_person_list: bool = False, inc_event_person_list: bool = False,
inc_event_presentation_list: bool = False, inc_event_presentation_list: bool = False,
inc_event_presenter_list: bool = False, inc_event_presenter_list: bool = False,
inc_event_registration_cfg: bool = False,
inc_event_registration_list: bool = False, inc_event_registration_list: bool = False,
inc_event_session_list: bool = False, inc_event_session_list: bool = False,
inc_event_track_list: bool = False, inc_event_track_list: bool = False,
inc_event_cfg: bool = False,
inc_event_registration_cfg: bool = False,
inc_poc_event_person: bool = False, inc_poc_event_person: bool = False,
inc_poc_person: bool = False, inc_poc_person: bool = False,
inc_user: bool = False, inc_user: bool = False,
@@ -250,17 +250,21 @@ async def get_event_obj_li(
# ### BEGIN ### API Event ### get_event_obj() ### # ### BEGIN ### API Event ### get_event_obj() ###
# Working well as of 2021-06-04. Using as a template for other routes. # Working well as of 2021-06-30. Using as a template for other routes.
@router.get('/{event_id}', response_model=Resp_Body_Base) @router.get('/{event_id}', response_model=Resp_Body_Base)
async def get_event_obj( async def get_event_obj(
event_id: str = Query(..., min_length=1, max_length=22), event_id: str = Query(..., min_length=1, max_length=22),
enabled: str = 'enabled', # For now this covers any included objects or object lists enabled: str = 'enabled', # For now this covers any included objects or object lists
limit: int = 500, # For now this covers any included objects or object lists limit: int = 500, # For now this covers any included objects or object lists
inc_contact_1: bool = False, inc_address: bool = False, # Under event and under contact
inc_contact_2: bool = False, # inc_address_location: bool = False,
inc_contact_3: bool = False, inc_contact: bool = False,
# inc_contact_1: bool = False,
# inc_contact_2: bool = False,
# inc_contact_3: bool = False,
inc_event_abstract_list: bool = False, inc_event_abstract_list: bool = False,
inc_event_badge_list: bool = False, inc_event_badge_list: bool = False,
inc_event_cfg: bool = False,
inc_event_device_list: bool = False, inc_event_device_list: bool = False,
inc_event_exhibit_list: bool = False, inc_event_exhibit_list: bool = False,
inc_event_file_list: bool = False, inc_event_file_list: bool = False,
@@ -270,14 +274,17 @@ async def get_event_obj(
inc_event_presentation_list: bool = False, inc_event_presentation_list: bool = False,
inc_event_presenter_cat: bool = False, inc_event_presenter_cat: bool = False,
inc_event_presenter_list: bool = False, inc_event_presenter_list: bool = False,
inc_event_registration_cfg: bool = False,
inc_event_registration_list: bool = False, inc_event_registration_list: bool = False,
inc_event_session_list: bool = False, inc_event_session_list: bool = False,
inc_event_track: bool = False, inc_event_track: bool = False,
inc_event_track_list: bool = False, inc_event_track_list: bool = False,
inc_event_cfg: bool = False, inc_organization: bool = False,
inc_event_registration_cfg: bool = False, inc_person: bool = False,
inc_location_address: bool = False,
inc_poc_event_person: bool = False, inc_poc_event_person: bool = False,
inc_product: bool = False,
inc_product_list: bool = False,
inc_user: bool = False,
x_account_id: str = Header(...), x_account_id: str = Header(...),
by_alias: Optional[bool] = True, by_alias: Optional[bool] = True,
exclude_unset: Optional[bool] = True, exclude_unset: Optional[bool] = True,
@@ -291,30 +298,39 @@ async def get_event_obj(
if event_obj := load_event_obj( if event_obj := load_event_obj(
event_id = event_id, event_id = event_id,
enabled = enabled,
limit = limit, limit = limit,
inc_contact_1 = inc_contact_1, by_alias = by_alias,
inc_contact_2 = inc_contact_2, exclude_unset = exclude_unset,
inc_contact_3 = inc_contact_3, # model_as_dict = model_as_dict,
inc_event_abstract_list = inc_event_abstract_list, enabled = enabled,
inc_event_badge_list = inc_event_badge_list, inc_address = inc_address,
inc_event_device_list = inc_event_device_list, # inc_address_location = inc_address_location,
inc_event_exhibit_list = inc_event_exhibit_list, inc_contact = inc_contact,
# inc_event_abstract_list = inc_event_abstract_list,
# inc_event_badge_list = inc_event_badge_list,
inc_event_cfg = inc_event_cfg,
# inc_event_device_list = inc_event_device_list,
# inc_event_exhibit_list = inc_event_exhibit_list,
inc_event_file_list = inc_event_file_list, inc_event_file_list = inc_event_file_list,
inc_event_location = inc_event_location, # inc_event_location = inc_event_location,
inc_event_location_list = inc_event_location_list, inc_event_location_list = inc_event_location_list,
# inc_event_person = inc_event_person,
inc_event_person_list = inc_event_person_list, inc_event_person_list = inc_event_person_list,
inc_event_presentation_list = inc_event_presentation_list, inc_event_presentation_list = inc_event_presentation_list,
inc_event_presenter_cat = inc_event_presenter_cat, # inc_event_presenter_cat = inc_event_presenter_cat,
inc_event_presenter_list = inc_event_presenter_list, inc_event_presenter_list = inc_event_presenter_list,
inc_event_registration_list = inc_event_registration_list, # inc_event_registration_cfg = inc_event_registration_cfg,
# inc_event_registration_list = inc_event_registration_list,
inc_event_session_list = inc_event_session_list, inc_event_session_list = inc_event_session_list,
inc_event_track = inc_event_track, # inc_event_track = inc_event_track,
inc_event_track_list = inc_event_track_list, # inc_event_track_list = inc_event_track_list,
inc_event_cfg = inc_event_cfg, # inc_order_list = inc_order_list,
inc_event_registration_cfg = inc_event_registration_cfg, inc_organization = inc_organization,
inc_location_address = inc_location_address, inc_person = inc_person,
inc_poc_event_person = inc_poc_event_person, inc_poc_event_person = inc_poc_event_person,
# inc_product = inc_product,
# inc_product_list = inc_product_list,
inc_user = inc_user,
): ):
# event_dict = event_obj.dict(by_alias=by_alias, exclude_unset=exclude_unset) # event_dict = event_obj.dict(by_alias=by_alias, exclude_unset=exclude_unset)
pass pass

View File

@@ -51,10 +51,10 @@ async def get_lookup_li(
table_name = f'v_lu_{for_lookup_name}' table_name = f'v_lu_{for_lookup_name}'
lu_time_zone_result = sql_select(table_name=table_name) lu_time_zone_result = sql_select(table_name=table_name)
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL # log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(lu_time_zone_result) log.debug(lu_time_zone_result)
log.debug(type(lu_time_zone_result)) log.debug(type(lu_time_zone_result))
lu_time_zone_result = lu_time_zone_result[0:10] # lu_time_zone_result = lu_time_zone_result[0:10]
# fake_li = [] # fake_li = []
# import secrets # import secrets
# for time_zone in lu_time_zone_result: # for time_zone in lu_time_zone_result: