Work on event and lookup related end points, methods, and models
This commit is contained in:
@@ -258,7 +258,7 @@ def get_event_location_rec_list(
|
||||
{sql_where_event_id}
|
||||
{sql_enabled}
|
||||
{sql_hidden}
|
||||
ORDER BY `event_location`.created_on DESC, `event_location`.updated_on DESC
|
||||
ORDER BY `event_location`.priority DESC, `event_location`.sort ASC, `event_location`.name ASC, `event_location`.created_on DESC, `event_location`.updated_on DESC
|
||||
{sql_limit};
|
||||
"""
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ 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.lib_general import log, logging
|
||||
|
||||
# from app.methods.event_file_methods import load_event_file_obj
|
||||
from app.methods.event_cfg_methods import load_event_cfg_obj
|
||||
from app.methods.event_person_methods import create_event_person_obj, load_event_person_obj, update_event_person_obj
|
||||
# from app.methods.person_methods import load_person_obj
|
||||
# from app.methods.user_methods import load_user_obj
|
||||
@@ -29,6 +29,7 @@ def load_event_presenter_obj(
|
||||
inc_contact: bool = False,
|
||||
inc_event_abstract_list: bool = False, # For event_presenter and using load_event_person_obj
|
||||
inc_event_badge: bool = False, # Using load_event_person_obj
|
||||
inc_event_cfg: bool = False,
|
||||
inc_event_device_list: bool = False, # For event_presenter and using load_event_person_obj
|
||||
inc_event_file_list: bool = False, # For event_presenter and using load_event_person_obj
|
||||
inc_event_person: bool = False, # Using load_event_person_obj
|
||||
@@ -83,6 +84,19 @@ def load_event_presenter_obj(
|
||||
|
||||
# if inc_event: pass
|
||||
if inc_event_abstract_list: pass
|
||||
|
||||
# Updated 2021-11-10
|
||||
if inc_event_cfg:
|
||||
log.info('Need to include event configuration...')
|
||||
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_presenter_obj.event_cfg = event_cfg_result
|
||||
else: event_presenter_obj.event_cfg = None
|
||||
|
||||
if inc_event_device_list: pass
|
||||
|
||||
if inc_event_file_list:
|
||||
|
||||
@@ -25,6 +25,10 @@ class Event_Location_Base(BaseModel):
|
||||
alias = 'event_location_id'
|
||||
)
|
||||
|
||||
code: Optional[str] = Field(
|
||||
alias = 'event_location_code'
|
||||
)
|
||||
|
||||
event_id_random: Optional[str]
|
||||
event_id: Optional[int]
|
||||
event_track_id_random: Optional[str] # Can a track be assigned to one location?
|
||||
@@ -56,6 +60,12 @@ class Event_Location_Base(BaseModel):
|
||||
created_on: Optional[datetime.datetime] = None
|
||||
updated_on: Optional[datetime.datetime] = None
|
||||
|
||||
# Including convenience data
|
||||
# This is only for convenience. Probably going to keep unless it causes a problem.
|
||||
event_name: Optional[str]
|
||||
event_start_datetime: Optional[datetime.datetime]
|
||||
event_end_datetime: Optional[datetime.datetime]
|
||||
|
||||
# Including other related objects
|
||||
#event: Optional[Event_Base]
|
||||
event_abstract_list: Optional[list] # Optional[Event_Abstract_Base]
|
||||
|
||||
@@ -10,6 +10,7 @@ from app.lib_general import log, logging
|
||||
from app.models.common_field_schema import base_fields, default_num_bytes
|
||||
# from app.models.event_models import Event_Base
|
||||
# from app.models.event_abstract_models import Event_Abstract_Base
|
||||
from app.models.event_cfg_models import Event_Cfg_Base
|
||||
from app.models.event_person_models import Event_Person_Base
|
||||
# from app.models.event_presentation_models import Event_Presentation_Base
|
||||
# from app.models.event_session_models import Event_Session_Base
|
||||
@@ -38,7 +39,6 @@ class Event_Presenter_Base(BaseModel):
|
||||
alias = 'event_presenter_code'
|
||||
)
|
||||
|
||||
|
||||
account_id_random: Optional[str]
|
||||
account_id: Optional[int]
|
||||
|
||||
@@ -143,6 +143,7 @@ class Event_Presenter_Base(BaseModel):
|
||||
# event_abstract: Optional[Event_Abstract_Base]
|
||||
event_abstract: Optional[dict]
|
||||
event_abstract_list: Optional[list] # Optional[Event_Abstract_Base] Is more than one abstract allowed per presenter?
|
||||
event_cfg: Optional[Event_Cfg_Base]
|
||||
# event_device_list: Optional[list] # Optional[Event_Device_Base]
|
||||
event_file_list: Optional[list] # Optional[Event_File_Base]
|
||||
# event_location: Optional[Event_Location_Base]
|
||||
|
||||
@@ -53,7 +53,7 @@ async def patch_event_location_obj_exist_v4(
|
||||
fail_any = fail_any,
|
||||
return_outline = False,
|
||||
): pass
|
||||
else: return mk_resp(data=False, status_code=400, response=response, status_message='The event location was not created. Check the field names and data types.')
|
||||
else: return mk_resp(data=False, status_code=400, response=response, status_message='The event location was not created or updated. Check the field names and data types.')
|
||||
|
||||
if update_event_location_obj_result:
|
||||
if return_obj:
|
||||
@@ -125,13 +125,16 @@ async def get_event_location_obj(
|
||||
|
||||
|
||||
# ### BEGIN ### API Event Location ### get_event_obj_event_location_list() ###
|
||||
# Updated 2021-10-09
|
||||
# Updated 2021-11-10
|
||||
@router.get('/event/{event_id}/event/location/list', response_model=Resp_Body_Base)
|
||||
async def get_event_obj_event_location_list(
|
||||
event_id: str = Query(..., min_length=11, max_length=22),
|
||||
enabled: str = 'enabled',
|
||||
hidden: str = 'not_hidden',
|
||||
limit: int = 500,
|
||||
inc_event_file_list: bool = False,
|
||||
inc_event_session_list: bool = False,
|
||||
inc_file_count: bool = False,
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
@@ -143,9 +146,6 @@ async def get_event_obj_event_location_list(
|
||||
if event_id := redis_lookup_id_random(record_id_random=event_id, table_name='event'): pass
|
||||
else: return mk_resp(data=None, status_code=404, response=response)
|
||||
|
||||
response_data = None
|
||||
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
|
||||
# Updated 2021-07-28
|
||||
if event_location_rec_list_result := get_event_location_rec_list(
|
||||
event_id = event_id,
|
||||
@@ -162,6 +162,9 @@ async def get_event_obj_event_location_list(
|
||||
exclude_unset = exclude_unset,
|
||||
# model_as_dict = model_as_dict,
|
||||
enabled = enabled,
|
||||
inc_event_file_list = inc_event_file_list,
|
||||
inc_event_session_list = inc_event_session_list,
|
||||
inc_file_count = inc_file_count,
|
||||
):
|
||||
event_location_result_list.append(load_event_location_result)
|
||||
else:
|
||||
|
||||
@@ -193,8 +193,8 @@ async def get_event_session_event_presentation_li(
|
||||
inc_event_person: bool = False, # Intended for event_presenter
|
||||
# inc_event_person_list: bool = False,
|
||||
inc_person: bool = False, # Intended for event_presenter > event_person
|
||||
review: str = 'ready', # ready, not_ready, all
|
||||
approved: str = 'approved', # approved, not_approved, all
|
||||
review: str = 'all', # ready, not_ready, all
|
||||
approved: str = 'all', # approved, not_approved, all
|
||||
hidden: str = 'not_hidden', # hidden, not_hidden, all
|
||||
inc_file_count: bool = False, # NOTE: file counts are from separate views
|
||||
x_account_id: str = Header(...),
|
||||
|
||||
@@ -242,6 +242,7 @@ async def get_event_presenter_obj(
|
||||
inc_contact: bool = False, # Under person
|
||||
inc_event_abstract_list: bool = False, # Part of event_presenter and under event_person obj
|
||||
inc_event_badge: bool = False, # Under event_person obj
|
||||
inc_event_cfg: bool = False,
|
||||
inc_event_device_list: bool = False, # Part of event_presenter and under event_person obj
|
||||
inc_event_file_list: bool = False, # Part of event_presenter and under event_person obj
|
||||
inc_event_person: bool = False,
|
||||
@@ -274,6 +275,7 @@ async def get_event_presenter_obj(
|
||||
inc_contact = inc_contact,
|
||||
inc_event_abstract_list = inc_event_abstract_list,
|
||||
inc_event_badge = inc_event_badge,
|
||||
inc_event_cfg = inc_event_cfg,
|
||||
inc_event_device_list = inc_event_device_list,
|
||||
inc_event_file_list = inc_event_file_list,
|
||||
inc_event_person = inc_event_person,
|
||||
|
||||
@@ -540,7 +540,7 @@ async def get_event_session_obj(
|
||||
|
||||
# ### BEGIN ### API Event Session ### get_event_event_session_obj_li() ###
|
||||
# Updated 2021-08-26
|
||||
@router.get('/event/{event_id}/session/list', response_model=Resp_Body_Base)
|
||||
@router.get('/event/{event_id}/event/session/list', response_model=Resp_Body_Base)
|
||||
async def get_event_event_session_obj_li(
|
||||
event_id: str = Query(..., min_length=11, max_length=22),
|
||||
enabled: str = 'enabled', # enabled, disabled, all
|
||||
@@ -555,8 +555,8 @@ async def get_event_event_session_obj_li(
|
||||
# inc_event_person_list: bool = False,
|
||||
inc_person: bool = False, # Intended for event_presenter > event_person
|
||||
inc_poc_event_person: bool = False,
|
||||
review: str = 'ready', # ready, not_ready, all
|
||||
approved: str = 'approved', # approved, not_approved, all
|
||||
review: str = 'all', # ready, not_ready, all
|
||||
approved: str = 'all', # approved, not_approved, all
|
||||
hidden: str = 'not_hidden', # hidden, not_hidden, all
|
||||
inc_file_count: bool = False, # NOTE: file counts are from separate views
|
||||
x_account_id: str = Header(...),
|
||||
|
||||
@@ -31,7 +31,7 @@ async def get_lookup_li(
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
allowed_lookup_tables = ['country', 'country_subdivision', 'event_session_type', 'file_purpose', 'membership_group_status', 'membership_person_status', 'membership_type_status', 'order_status', 'post_topic', 'product_type', 'time_zone', 'user_status']
|
||||
allowed_lookup_tables = ['country', 'country_subdivision', 'education_degree', 'education_level', 'event_session_type', 'file_purpose', 'membership_group_status', 'membership_person_status', 'membership_type_status', 'order_status', 'post_topic', 'product_type', 'time_zone', 'user_status']
|
||||
|
||||
if for_lookup_name in allowed_lookup_tables: pass
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user