General clean up. Work on abstracts and websockets
This commit is contained in:
@@ -8,7 +8,8 @@ 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.core_object_models import Core_Std_Obj_Base
|
||||
# from app.models.event_models import Event_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_presenter_models import Event_Presenter_Base # This creates an import loop
|
||||
@@ -65,13 +66,15 @@ class Event_Abstract_Base(BaseModel):
|
||||
group: Optional[str]
|
||||
|
||||
notes: Optional[str]
|
||||
|
||||
created_on: Optional[datetime.datetime] = None
|
||||
updated_on: Optional[datetime.datetime] = None
|
||||
|
||||
# Including other related objects
|
||||
#event: Optional[Event_Base]
|
||||
# event: Optional[Event_Base]
|
||||
event_file_list: Optional[list] # Optional[Event_File_Base]
|
||||
# event_person: Optional[Event_Person_Base]
|
||||
event_person: Optional[dict]
|
||||
# event_presentation: Optional[Event_Presentation_Base]
|
||||
#event_presenter: Optional[Event_Presenter_Base] # This creates an import loop
|
||||
event_presenter_list: Optional[list] # Optional[Event_Presenter_Base]
|
||||
@@ -138,3 +141,137 @@ class Event_Abstract_Base(BaseModel):
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
# ### END ### API Event Abstract Models ### Event_Abstract_Base() ###
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# ### BEGIN ### API Event Abstract Models ### Event_Abstract_Base() ###
|
||||
# Update 2023-03-22
|
||||
class Event_Abstract_Base_New(Core_Std_Obj_Base):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
# id_random: Optional[str] = Field(
|
||||
# alias = 'event_abstract_id_random',
|
||||
# )
|
||||
|
||||
event_id_random: Optional[str]
|
||||
event_id: Optional[int]
|
||||
|
||||
event_person_id: Optional[int]
|
||||
|
||||
event_session_id: Optional[int]
|
||||
|
||||
event_person_id_random: Optional[str]
|
||||
|
||||
event_presentation_id_random: Optional[str]
|
||||
|
||||
event_presenter_id_random: Optional[str]
|
||||
|
||||
event_session_id_random: Optional[str]
|
||||
|
||||
# event_track_id_random: Optional[str]
|
||||
|
||||
poc_event_person_id_random: Optional[str] # Maybe change this to primary_event_person?
|
||||
|
||||
description: Optional[str]
|
||||
abstract: Optional[str]
|
||||
|
||||
class Config:
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
# ### END ### API Event Abstract Models ### Event_Abstract_Base() ###
|
||||
|
||||
|
||||
# ### BEGIN ### API Event Abstract Models ### Event_Abstract_In() ###
|
||||
# Update 2023-03-22
|
||||
class Event_Abstract_In(Event_Abstract_Base_New):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
id: Optional[int] = Field(
|
||||
alias = 'event_abstract_id'
|
||||
)
|
||||
|
||||
event_id: Optional[int]
|
||||
|
||||
event_person_id: Optional[int]
|
||||
|
||||
event_session_id: Optional[int]
|
||||
|
||||
|
||||
@validator('id', always=True)
|
||||
def event_abstract_id_lookup(cls, v, values, **kwargs):
|
||||
if isinstance(v, int) and v > 0: return v
|
||||
elif id_random := values.get('id_random'):
|
||||
return redis_lookup_id_random(record_id_random=id_random, table_name='event_abstract')
|
||||
return None
|
||||
|
||||
@validator('event_id', always=True)
|
||||
def event_id_lookup(cls, v, values, **kwargs):
|
||||
if isinstance(v, int) and v > 0: return v
|
||||
elif id_random := values.get('event_id_random'):
|
||||
return redis_lookup_id_random(record_id_random=id_random, table_name='event')
|
||||
return None
|
||||
|
||||
@validator('event_person_id', always=True)
|
||||
def event_person_id_lookup(cls, v, values, **kwargs):
|
||||
if isinstance(v, int) and v > 0: return v
|
||||
elif id_random := values.get('event_person_id_random'):
|
||||
return redis_lookup_id_random(record_id_random=id_random, table_name='event_person')
|
||||
return None
|
||||
|
||||
# @validator('event_presentation_id', always=True)
|
||||
# def event_presentation_id_lookup(cls, v, values, **kwargs):
|
||||
# if isinstance(v, int) and v > 0: return v
|
||||
# elif id_random := values.get('event_presentation_id_random'):
|
||||
# return redis_lookup_id_random(record_id_random=id_random, table_name='event_presentation')
|
||||
# return None
|
||||
|
||||
# @validator('event_presenter_id', always=True)
|
||||
# def event_presenter_id_lookup(cls, v, values, **kwargs):
|
||||
# if isinstance(v, int) and v > 0: return v
|
||||
# elif id_random := values.get('event_presenter_id_random'):
|
||||
# return redis_lookup_id_random(record_id_random=id_random, table_name='event_presenter')
|
||||
# return None
|
||||
|
||||
@validator('event_session_id', always=True)
|
||||
def event_session_id_lookup(cls, v, values, **kwargs):
|
||||
if isinstance(v, int) and v > 0: return v
|
||||
elif id_random := values.get('event_session_id_random'):
|
||||
return redis_lookup_id_random(record_id_random=id_random, table_name='event_session')
|
||||
return None
|
||||
|
||||
# @validator('poc_event_person_id', always=True)
|
||||
# def poc_event_person_id_lookup(cls, v, values, **kwargs):
|
||||
# log.setLevel(logging.WARNING)
|
||||
# log.debug(locals())
|
||||
|
||||
# if values['poc_event_person_id_random']:
|
||||
# return redis_lookup_id_random(record_id_random=values['poc_event_person_id_random'], table_name='poc_event_person')
|
||||
# return None
|
||||
# ### END ### API Event Abstract Models ### Event_Abstract_In() ###
|
||||
|
||||
|
||||
# ### BEGIN ### API Event Abstract Models ### Event_Abstract_Ext() ###
|
||||
# Update 2023-03-22
|
||||
class Event_Abstract_Ext(Event_Abstract_Base_New):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
# Including other related objects
|
||||
# event: Optional[Event_Base]
|
||||
event_file_list: Optional[list] # Optional[Event_File_Base]
|
||||
# from app.models.event_person_models import Event_Person_Base
|
||||
# event_person: Optional[Event_Person_Base]
|
||||
event_person: Optional[dict]
|
||||
# event_presentation: Optional[Event_Presentation_Base]
|
||||
#event_presenter: Optional[Event_Presenter_Base] # This creates an import loop
|
||||
# event_presenter_list: Optional[list] # Optional[Event_Presenter_Base]
|
||||
# event_session: Optional[Event_Session_Base]
|
||||
# event_track: Optional[Event_Track_Base]
|
||||
# poc_event_person: Optional[Event_Person_Base] # Maybe change this to primary_event_person?
|
||||
# poc_person: Optional[Person_Base] # Maybe change this to primary_person?
|
||||
# ### END ### API Event Abstract Models ### Event_Abstract_Ext() ###
|
||||
|
||||
Reference in New Issue
Block a user