General clean up

This commit is contained in:
Scott Idem
2022-08-12 14:06:43 -04:00
parent 8bcd67d935
commit f067aefdca
7 changed files with 16 additions and 60 deletions

View File

@@ -61,7 +61,7 @@ def load_event_obj(
inc_poc_event_person: bool = False,
inc_product: bool = False,
inc_product_list: bool = False,
inc_user: bool = False,
# inc_user: bool = False,
limit: int = 1000,
offset: int = 0,
by_alias: bool = True,
@@ -713,7 +713,7 @@ def load_event_obj_list(
inc_address_location: bool = False,
inc_poc_event_person: bool = False,
inc_person: bool = False,
inc_user: bool = False,
# inc_user: bool = False,
) -> list|bool:
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())

View File

@@ -23,9 +23,6 @@ class Event_Badge_Base(BaseModel):
alias = 'event_badge_id'
)
# account_id_random: Optional[str]
# account_id: Optional[int]
event_id_random: Optional[str]
event_id: Optional[int]
@@ -155,15 +152,6 @@ class Event_Badge_Base(BaseModel):
_processed_at: datetime.datetime = PrivateAttr(default_factory=datetime.datetime.now)
#@validator('event_badge_id_random', always=True)
def event_badge_id_random_copy(cls, v, values, **kwargs):
log.setLevel(logging.WARNING)
log.debug(locals())
if values['id_random']:
return values['id_random']
return None
@validator('id', always=True)
def event_badge_id_lookup(cls, v, values, **kwargs):
if isinstance(v, int) and v > 0: return v

View File

@@ -10,7 +10,9 @@ from app.models.common_field_schema import base_fields, default_num_bytes
from app.models.address_models import Address_Base
from app.models.contact_models import Contact_Base
from app.models.event_cfg_models import Event_Cfg_Base
from app.models.event_location_models import Event_Location_Base
from app.models.event_person_models import Event_Person_Base
from app.models.event_session_models import Event_Session_Base
from app.models.person_models import Person_Base
from app.models.user_models import User_Base
@@ -144,11 +146,11 @@ class Event_Base(BaseModel):
event_device_list: Optional[list] # Optional[Event_Device_Base]
event_exhibit_list: Optional[list]
event_file_list: Optional[list] # Optional[Event_File_Base]
event_location_list: Optional[list] # Optional[Event_Location_Base]
event_location_list: Optional[list[Event_Location_Base]] # Optional[list]
event_person_list: Optional[list]
event_presentation_list: Optional[list] # Optional[Event_Presentation_Base]
event_presenter_list: Optional[list] # Optional[Event_Presenter_Base]
event_session_list: Optional[list] # Optional[Event_Session_Base]
event_session_list: Optional[list[Event_Session_Base]] # Optional[list]
event_track_list: Optional[list] # Optional[Event_Track_Base]
# poc_event_person: Optional[Event_Person_Base]
poc_person: Optional[Person_Base]

View File

@@ -7,11 +7,9 @@ from app.db_sql import redis_lookup_id_random
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 # This creates an import loop
from app.models.event_person_models import Event_Person_Base
from app.models.event_presenter_models import Event_Presenter_Base
# from app.models.event_session_models import Event_Session_Base
from app.models.person_models import Person_Base
@@ -107,12 +105,6 @@ class Event_Presentation_Base(BaseModel):
_processed_at: datetime.datetime = PrivateAttr(default_factory=datetime.datetime.now)
#@validator('event_presentation_id_random', always=True)
def event_presentation_id_random_copy(cls, v, values, **kwargs):
if values['id_random']:
return values['id_random']
return None
@validator('id', always=True)
def event_presentation_id_lookup(cls, v, values, **kwargs):
if isinstance(v, int) and v > 0: return v

View File

@@ -37,9 +37,6 @@ class Event_Presenter_Base(BaseModel):
alias = 'event_presenter_code'
)
account_id_random: Optional[str]
account_id: Optional[int]
event_id_random: Optional[str]
event_id: Optional[int]
@@ -61,9 +58,6 @@ class Event_Presenter_Base(BaseModel):
event_track_id_random: Optional[str]
event_track_id: Optional[int]
# person_id_random: Optional[str]
# person_id: Optional[int]
for_type: Optional[str]
for_id: Optional[int]
@@ -85,12 +79,12 @@ class Event_Presenter_Base(BaseModel):
full_name: Optional[str]
degree: Optional[str] # NOTE: Phasing out! Use *designations* instead.
degrees: Optional[str] # NOTE: Phasing out! Use *designations* instead.
credentials: Optional[str] # NOTE: Phasing out! Use *designations* instead.
# degree: Optional[str] # NOTE: Phasing out! Use *designations* instead.
# degrees: Optional[str] # NOTE: Phasing out! Use *designations* instead.
# credentials: Optional[str] # NOTE: Phasing out! Use *designations* instead.
affiliations: Optional[str] # One or more affiliations with organizations, companies, and other groups
affiliation: Optional[str] # NOTE: Phasing out! Use *affiliations* instead.
# affiliation: Optional[str] # NOTE: Phasing out! Use *affiliations* instead.
email: Optional[str]
website_url: Optional[str]
@@ -160,12 +154,6 @@ class Event_Presenter_Base(BaseModel):
_processed_at: datetime.datetime = PrivateAttr(default_factory=datetime.datetime.now)
#@validator('event_presenter_id_random', always=True)
def event_presenter_id_random_copy(cls, v, values, **kwargs):
if values['id_random']:
return values['id_random']
return None
@validator('id', always=True)
def event_presenter_id_lookup(cls, v, values, **kwargs):
if isinstance(v, int) and v > 0: return v
@@ -173,13 +161,6 @@ class Event_Presenter_Base(BaseModel):
return redis_lookup_id_random(record_id_random=id_random, table_name='event_presenter')
return None
@validator('account_id', always=True)
def account_id_lookup(cls, v, values, **kwargs):
if isinstance(v, int) and v > 0: return v
elif id_random := values.get('account_id_random'):
return redis_lookup_id_random(record_id_random=id_random, table_name='account')
return None
@validator('event_id', always=True)
def event_id_lookup(cls, v, values, **kwargs):
if isinstance(v, int) and v > 0: return v

View File

@@ -7,7 +7,6 @@ from app.db_sql import redis_lookup_id_random
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_location_models import Event_Location_Base
from app.models.event_person_models import Event_Person_Base # NOTE: Using this will probably create an import loop
from app.models.event_presentation_models import Event_Presentation_Base
@@ -141,12 +140,6 @@ class Event_Session_Base(BaseModel):
_processed_at: datetime.datetime = PrivateAttr(default_factory=datetime.datetime.now)
#@validator('event_session_id_random', always=True)
def event_session_id_random_copy(cls, v, values, **kwargs):
if values['id_random']:
return values['id_random']
return None
@validator('id', always=True)
def event_session_id_lookup(cls, v, values, **kwargs):
if isinstance(v, int) and v > 0: return v

View File

@@ -107,7 +107,7 @@ async def get_event_obj_li(
inc_event_track_list: bool = False,
inc_poc_event_person: bool = False,
inc_poc_person: bool = False,
inc_user: bool = False,
# inc_user: bool = False,
x_account_id: str = Header(...),
by_alias: bool = True,
exclude_unset: bool = True,
@@ -192,7 +192,7 @@ async def get_event_obj_li(
inc_event_registration_cfg = inc_event_registration_cfg,
inc_poc_event_person = inc_poc_event_person,
# inc_poc_person = inc_poc_person,
inc_user = inc_user,
# inc_user = inc_user,
):
data = event_obj.dict(by_alias=by_alias, exclude_unset=exclude_unset) # pylint: disable=no-member
@@ -241,7 +241,7 @@ async def get_event_obj(
inc_poc_event_person: bool = False,
inc_product: bool = False,
inc_product_list: bool = False,
inc_user: bool = False,
# inc_user: bool = False,
inc_file_count: bool = False, # NOTE: file counts are from separate views
x_account_id: str = Header(...),
limit: int = 500, # For now this covers any included objects or object lists
@@ -289,7 +289,7 @@ async def get_event_obj(
inc_poc_event_person = inc_poc_event_person,
# inc_product = inc_product,
# inc_product_list = inc_product_list,
inc_user = inc_user,
# inc_user = inc_user,
limit = limit,
by_alias = by_alias,
exclude_unset = exclude_unset,
@@ -343,7 +343,7 @@ async def get_account_obj_event_list(
inc_poc_event_person: bool = False,
inc_product: bool = False,
inc_product_list: bool = False,
inc_user: bool = False,
# inc_user: bool = False,
x_account_id: str = Header(...),
by_alias: Optional[bool] = True,
exclude_unset: Optional[bool] = True,
@@ -398,7 +398,7 @@ async def get_account_obj_event_list(
inc_person = inc_person,
# inc_product = inc_product,
# inc_product_list = inc_product_list,
inc_user = inc_user,
# inc_user = inc_user,
):
event_result_list.append(load_event_result)
else: