Working on post and post_comment and event
This commit is contained in:
@@ -811,6 +811,14 @@ def lookup_id_random_pop(obj_data:dict):
|
||||
obj_data['contact_id'] = redis_lookup_id_random(record_id_random=obj_data['contact_id_random'], table_name='contact')
|
||||
obj_data.pop('contact_id_random')
|
||||
|
||||
if 'contact_1_id_random' in obj_data:
|
||||
obj_data['contact_1_id'] = redis_lookup_id_random(record_id_random=obj_data['contact_1_id_random'], table_name='contact')
|
||||
obj_data.pop('contact_1_id_random')
|
||||
|
||||
if 'contact_2_id_random' in obj_data:
|
||||
obj_data['contact_2_id'] = redis_lookup_id_random(record_id_random=obj_data['contact_2_id_random'], table_name='contact')
|
||||
obj_data.pop('contact_2_id_random')
|
||||
|
||||
if 'event_id_random' in obj_data:
|
||||
obj_data['event_id'] = redis_lookup_id_random(record_id_random=obj_data.get('event_id_random', None), table_name='event')
|
||||
obj_data.pop('event_id_random')
|
||||
|
||||
@@ -25,16 +25,20 @@ class Event_Base(BaseModel):
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
#alias = 'event_id'
|
||||
alias = 'event_id'
|
||||
)
|
||||
account_id_random: Optional[str]
|
||||
account_id: Optional[int]
|
||||
|
||||
poc_event_person_id_random: Optional[str]
|
||||
poc_event_person_id: Optional[int]
|
||||
|
||||
poc_person_id_random: Optional[str]
|
||||
poc_person_id: Optional[int]
|
||||
|
||||
user_id_random: Optional[str]
|
||||
user_id: Optional[int]
|
||||
|
||||
lu_event_type_id: Optional[int]
|
||||
#lu_event_type: Optional[str] # Needs to be reviewed
|
||||
|
||||
@@ -169,7 +173,6 @@ class Event_Base(BaseModel):
|
||||
return redis_lookup_id_random(record_id_random=values['poc_person_id_random'], table_name='person')
|
||||
return None
|
||||
|
||||
|
||||
@validator('user_id', always=True)
|
||||
def user_id_lookup(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.WARNING)
|
||||
@@ -181,6 +184,7 @@ class Event_Base(BaseModel):
|
||||
|
||||
class Config:
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user