fix(legacy): resolve 422 error on site domain lookup and enhance V3 filtering
This commit is contained in:
@@ -100,8 +100,8 @@ class Site_Domain_FQDN_ID_Base(BaseModel):
|
||||
log.debug(locals())
|
||||
|
||||
id_random: Optional[str] = Field(
|
||||
# **base_fields['site_domain_id_random'],
|
||||
# alias = 'site_domain_id_random',
|
||||
**base_fields['site_domain_id_random'],
|
||||
alias = 'site_domain_id_random',
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'site_domain_id'
|
||||
@@ -157,6 +157,20 @@ class Site_Domain_FQDN_ID_Base(BaseModel):
|
||||
|
||||
_processed_at: datetime.datetime = PrivateAttr(default_factory=datetime.datetime.now)
|
||||
|
||||
@validator('id', always=True)
|
||||
def 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='site_domain')
|
||||
return None
|
||||
|
||||
@validator('site_domain_id_random', always=True)
|
||||
def site_domain_id_random_lookup(cls, v, values, **kwargs):
|
||||
if isinstance(v, str) and len(v) >= 11: return v
|
||||
elif id_random := values.get('id_random'):
|
||||
return id_random
|
||||
return None
|
||||
|
||||
@validator('account_id', always=True)
|
||||
def account_id_lookup(cls, v, values, **kwargs):
|
||||
if isinstance(v, int) and v > 0: return v
|
||||
|
||||
Reference in New Issue
Block a user