fix: import SearchFilter in api_crud_v3.py to resolve NameError
This commit is contained in:
@@ -16,7 +16,7 @@ from app.lib_general_v3 import (
|
||||
DelayParams, get_delay_params
|
||||
)
|
||||
from app.models.response_models import *
|
||||
from app.models.api_crud_models import SearchQuery
|
||||
from app.models.api_crud_models import SearchFilter, SearchQuery
|
||||
from app.ae_obj_types_def import obj_type_kv_li
|
||||
from app.db_sql import redis_lookup_id_random, sql_select, sql_insert, sql_update, sql_delete, get_id_random
|
||||
|
||||
@@ -451,10 +451,13 @@ async def search_obj_li(
|
||||
# Forced account isolation for the search query itself
|
||||
# We inject the account_id into the SearchQuery object if it's not a super user
|
||||
if not account.super and account.auth_method != 'bypass' and account.account_id:
|
||||
if search_query.and_filters is None:
|
||||
search_query.and_filters = []
|
||||
|
||||
if obj_name == 'account':
|
||||
search_query.and_filter['id'] = account.account_id
|
||||
search_query.and_filters.append(SearchFilter(field='id', op='eq', value=account.account_id))
|
||||
elif base_name and hasattr(base_name, '__fields__') and 'account_id' in base_name.__fields__:
|
||||
search_query.and_filter['account_id'] = account.account_id
|
||||
search_query.and_filters.append(SearchFilter(field='account_id', op='eq', value=account.account_id))
|
||||
|
||||
if for_obj_type and for_obj_id:
|
||||
resolved_for_obj_id = redis_lookup_id_random(record_id_random=for_obj_id, table_name=for_obj_type)
|
||||
|
||||
Reference in New Issue
Block a user