Working on event registration. Why wont it load???

This commit is contained in:
Scott Idem
2021-08-13 18:09:41 -04:00
parent 1bb3867463
commit 8fd8b89ff4
4 changed files with 92 additions and 14 deletions

View File

@@ -11,6 +11,8 @@ from app.db_sql import *
from .api_crud import delete_obj_template, get_obj_template, get_obj_li_template, patch_obj_template, post_obj_template
from app.methods.event_registration_methods import load_event_registration_obj
from app.models.event_registration_models import Event_Registration_Base
from app.models.response_models import *
@@ -93,25 +95,46 @@ async def get_event_registration_obj_li(
return result
@router.get('/{obj_id}', response_model=Resp_Body_Base)
@router.get('/{event_registration_id}', response_model=Resp_Body_Base)
async def get_event_registration_obj(
obj_id: str = Query(..., min_length=1, max_length=22),
event_registration_id: str = Query(..., min_length=1, max_length=22),
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
inc_event_registration_cfg: bool = False,
inc_event_registration_list: bool = False,
x_account_id: str = Header(...),
by_alias: Optional[bool] = True,
exclude_unset: Optional[bool] = True,
response: Response = Response,
):
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
obj_type = 'event_registration'
result = get_obj_template(
obj_type=obj_type,
obj_id=obj_id,
by_alias=True,
exclude_unset=True,
)
return result
if event_registration_id := redis_lookup_id_random(record_id_random=event_registration_id, table_name='event_registration'): pass
else: return mk_resp(data=None, status_code=404)
if event_registration_obj := load_event_registration_obj(
event_registration_id = event_registration_id,
limit = limit,
by_alias = by_alias,
exclude_unset = exclude_unset,
# model_as_dict = model_as_dict,
enabled = enabled,
):
pass
else:
return mk_resp(data=False, status_code=400, response=response) # Bad Request
return mk_resp(data=event_registration_obj)
# obj_type = 'event_registration'
# result = get_obj_template(
# obj_type=obj_type,
# obj_id=event_registration_id,
# by_alias=True,
# exclude_unset=True,
# )
# return result
@router.delete('/{obj_id}', response_model=Resp_Body_Base)