A lot of changes related to person and membership and event
This commit is contained in:
@@ -9,7 +9,7 @@ from app.db_sql import sql_insert, sql_update, sql_insert_or_update, sql_select,
|
||||
|
||||
from app.routers.api_crud import delete_obj_template, get_obj_template, get_obj_li_template, patch_obj_template, post_obj_template
|
||||
|
||||
from app.methods.event_methods import load_event_obj, update_event_obj
|
||||
from app.methods.event_methods import get_event_rec_list, load_event_obj, update_event_obj
|
||||
|
||||
from app.models.event_models import Event_Base
|
||||
from app.models.response_models import Resp_Body_Base, mk_resp
|
||||
@@ -341,6 +341,72 @@ async def get_event_obj(
|
||||
# ### END ### API Event ### get_event_obj() ###
|
||||
|
||||
|
||||
|
||||
# ### BEGIN ### API Event Methods ### get_person_event_obj_li() ###
|
||||
# Updated 2021-07-12
|
||||
@router.get('/person/{person_id}/event/list', response_model=Resp_Body_Base)
|
||||
async def get_person_event_obj_li(
|
||||
person_id: str = Query(..., min_length=1, max_length=22),
|
||||
enabled: str = 'enabled',
|
||||
limit: int = 1000,
|
||||
conference: bool = False, # If it is a conference then organization, person, and user are queried as participants (not the owner/organizer)
|
||||
inc_address: bool = False,
|
||||
inc_contact: bool = False,
|
||||
inc_event_abstract_list: bool = False,
|
||||
inc_event_badge: bool = False,
|
||||
inc_event_cfg: bool = False,
|
||||
inc_event_exhibit_list: bool = False,
|
||||
inc_event_file_list: bool = False,
|
||||
inc_event_presentation_list: bool = False,
|
||||
inc_event_presenter_list: bool = False,
|
||||
inc_event_registration: bool = False,
|
||||
inc_event_session_list: bool = False,
|
||||
inc_event_track_list: bool = False,
|
||||
inc_organization: bool = False,
|
||||
inc_person: 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 person_id := redis_lookup_id_random(record_id_random=person_id, table_name='person'): pass
|
||||
else: return mk_resp(data=None, status_code=404)
|
||||
|
||||
# Updated 2021-07-12
|
||||
if event_rec_list_result := get_event_rec_list(
|
||||
person_id = person_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),
|
||||
enabled = enabled,
|
||||
limit = limit,
|
||||
inc_address = inc_address,
|
||||
inc_contact = inc_contact,
|
||||
inc_event_cfg = inc_event_cfg,
|
||||
inc_organization = inc_organization,
|
||||
inc_person = inc_person,
|
||||
by_alias = by_alias,
|
||||
exclude_unset = exclude_unset,
|
||||
# model_as_dict = model_as_dict,
|
||||
):
|
||||
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 Event Methods ### get_person_event_obj_li() ###
|
||||
|
||||
|
||||
@router.delete('/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def delete_event_obj(
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
|
||||
@@ -269,3 +269,37 @@ async def get_event_person_obj(
|
||||
|
||||
return mk_resp(data=event_person_obj)
|
||||
# ### END ### API Event ### get_event_person_obj() ###
|
||||
|
||||
|
||||
# ### BEGIN ### API Event Person Methods ### get_person_event_person_obj_li() ###
|
||||
# Updated 2021-07-12
|
||||
@router.get('/person/{person_id}/event/person/list', response_model=Resp_Body_Base)
|
||||
async def get_person_event_person_obj_li(
|
||||
person_id: str = Query(..., min_length=1, max_length=22),
|
||||
enabled: str = 'enabled',
|
||||
limit: int = 1000,
|
||||
inc_address: bool = False,
|
||||
inc_contact: bool = False,
|
||||
# inc_event: bool = False,
|
||||
inc_event_abstract_list: bool = False,
|
||||
inc_event_badge: bool = False,
|
||||
inc_event_exhibit_list: bool = False,
|
||||
inc_event_file_list: bool = False,
|
||||
inc_event_presentation_list: bool = False,
|
||||
inc_event_presenter_list: bool = False,
|
||||
inc_event_registration: bool = False,
|
||||
inc_event_session_list: bool = False,
|
||||
inc_event_track_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 person_id := redis_lookup_id_random(record_id_random=person_id, table_name='person'): pass
|
||||
else: return mk_resp(data=None, status_code=404)
|
||||
|
||||
return mk_resp(data=response_data)
|
||||
# ### BEGIN ### API Event Person Methods ### get_person_event_person_obj_li() ###
|
||||
|
||||
Reference in New Issue
Block a user