Working on event registration. Why wont it load???
This commit is contained in:
54
app/methods/event_registration_methods.py
Normal file
54
app/methods/event_registration_methods.py
Normal file
@@ -0,0 +1,54 @@
|
||||
from __future__ import annotations
|
||||
import datetime
|
||||
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
from pydantic import BaseModel, EmailStr, Field, PrivateAttr, ValidationError, validator
|
||||
|
||||
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.address_methods import load_address_obj
|
||||
# from app.methods.contact_methods import load_contact_obj
|
||||
from app.methods.event_cfg_methods import load_event_cfg_obj
|
||||
from app.methods.person_methods import load_person_obj
|
||||
|
||||
from app.models.event_registration_models import Event_Registration_Base
|
||||
from app.models.event_cfg_models import Event_Cfg_Base
|
||||
|
||||
|
||||
# ### BEGIN ### API Event Registration Methods ### load_event_registration_obj() ###
|
||||
def load_event_registration_obj(
|
||||
event_registration_id: int|str,
|
||||
limit: int = 1000,
|
||||
by_alias: bool = True,
|
||||
exclude_unset: bool = True,
|
||||
model_as_dict: bool = False,
|
||||
enabled: str = 'enabled', # enabled, disabled, all
|
||||
inc_address: bool = False, # Under contact
|
||||
inc_contact: bool = False,
|
||||
inc_event_cfg: bool = False,
|
||||
inc_event_person_list: bool = False,
|
||||
inc_event_registration_cfg: bool = False,
|
||||
inc_person: bool = False,
|
||||
) -> Event_Registration_Base|bool:
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
if event_registration_id := redis_lookup_id_random(record_id_random=event_registration_id, table_name='event_registration'): pass
|
||||
else: return False
|
||||
|
||||
if event_registration_rec := sql_select(table_name='v_event_registration', record_id=event_registration_id): pass
|
||||
else: return False
|
||||
|
||||
print('******************************** HERE')
|
||||
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(event_registration_rec)
|
||||
|
||||
try:
|
||||
event_registration_obj = Event_Registration_Base(**event_registration_rec)
|
||||
log.debug(event_registration_obj)
|
||||
except ValidationError as e:
|
||||
log.error(e.json())
|
||||
return False
|
||||
# ### END ### API Event Registration Methods ### load_event_registration_obj() ###
|
||||
Reference in New Issue
Block a user