fix(legacy): resolve 422 error on site domain lookup and enhance V3 filtering
This commit is contained in:
@@ -699,8 +699,28 @@ async def get_obj_l2(
|
||||
# exclude: Optional[list] = [],
|
||||
# exclude_none: Optional[bool] = True,
|
||||
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
commons: Common_Route_Params = Depends(common_route_params_min),
|
||||
):
|
||||
# ### SECTION ### Special Case: site/domain lookup by FQDN
|
||||
if obj_type_l1 == 'site' and obj_type_l2 == 'domain':
|
||||
log.info(f'Special Case: Site Domain lookup by FQDN: {obj_id}')
|
||||
|
||||
table_name = 'v_site_domain_fqdn_id' if use_alt_table else 'v_site_domain'
|
||||
base_name = Site_Domain_FQDN_ID_Base if use_alt_base else Site_Domain_Base
|
||||
|
||||
sql_result = sql_select(
|
||||
table_name=table_name,
|
||||
field_name='fqdn',
|
||||
field_value=obj_id,
|
||||
as_list=False
|
||||
)
|
||||
|
||||
if sql_result:
|
||||
resp_data = base_name(**sql_result).dict(by_alias=commons.by_alias, exclude_unset=commons.exclude_unset)
|
||||
return mk_resp(data=resp_data, response=commons.response)
|
||||
else:
|
||||
return mk_resp(data=False, status_code=404, response=commons.response)
|
||||
|
||||
# ### SECTION ### Call generic function to get the object
|
||||
return handle_get_obj_id(
|
||||
obj_type_l1=obj_type_l1,
|
||||
|
||||
Reference in New Issue
Block a user