More work on abstract submissions and related grants
This commit is contained in:
@@ -52,9 +52,15 @@ class Event_Abstract_Base(BaseModel):
|
||||
# poc_event_person_id: Optional[int] # Maybe change this to primary_event_person?
|
||||
|
||||
external_id: Optional[str]
|
||||
grant_id: Optional[str]
|
||||
code: Optional[str]
|
||||
|
||||
grant_id_random: Optional[str]
|
||||
grant_id: Optional[int]
|
||||
|
||||
grant_code: Optional[str]
|
||||
# grant_type_code: Optional[str]
|
||||
# grant_json: Optional[Union[Json, None]]
|
||||
|
||||
name: Optional[str]
|
||||
description: Optional[str]
|
||||
abstract: Optional[str]
|
||||
@@ -131,6 +137,13 @@ class Event_Abstract_Base(BaseModel):
|
||||
return redis_lookup_id_random(record_id_random=id_random, table_name='event_session')
|
||||
return None
|
||||
|
||||
@validator('grant_id', always=True)
|
||||
def grant_id_lookup(cls, v, values, **kwargs):
|
||||
if isinstance(v, int) and v > 0: return v
|
||||
elif id_random := values.get('grant_id_random'):
|
||||
return redis_lookup_id_random(record_id_random=id_random, table_name='grant')
|
||||
return None
|
||||
|
||||
# @validator('poc_event_person_id', always=True)
|
||||
# def poc_event_person_id_lookup(cls, v, values, **kwargs):
|
||||
# log.setLevel(logging.WARNING)
|
||||
@@ -188,7 +201,9 @@ class Event_Abstract_Base_New(Core_Std_Obj_Base):
|
||||
|
||||
passcode: Optional[str]
|
||||
|
||||
grant_id_random: Optional[str]
|
||||
grant_id: Optional[int]
|
||||
|
||||
grant_code: Optional[str]
|
||||
grant_type_code: Optional[str]
|
||||
grant_json: Optional[Union[Json, None]]
|
||||
@@ -201,6 +216,13 @@ class Event_Abstract_Base_New(Core_Std_Obj_Base):
|
||||
submitter_json: Optional[Union[Json, None]]
|
||||
coauthors_json: Optional[Union[Json, 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
|
||||
|
||||
class Config:
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
@@ -269,14 +291,12 @@ class Event_Abstract_In(Event_Abstract_Base_New):
|
||||
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
|
||||
@validator('grant_id', always=True)
|
||||
def grant_id_lookup(cls, v, values, **kwargs):
|
||||
if isinstance(v, int) and v > 0: return v
|
||||
elif id_random := values.get('grant_id_random'):
|
||||
return redis_lookup_id_random(record_id_random=id_random, table_name='grant')
|
||||
return None
|
||||
# ### END ### API Event Abstract Models ### Event_Abstract_In() ###
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user