@@ -71,13 +71,17 @@ def __init__(self):
7171 def find_all (
7272 self ,
7373 event_context : EventContext ,
74+ conditions : dict = None ,
7475 project_ids : List [str ] = None ,
7576 customer_ids : List [str ] = None ,
7677 visible_only = True ,
7778 mapper : Callable = None ,
7879 ):
80+ params = self .generate_params (conditions ) if conditions else []
81+
7982 query_builder = (
8083 CosmosDBQueryBuilder ()
84+ .add_sql_where_equal_condition (conditions )
8185 .add_sql_in_condition ("id" , project_ids )
8286 .add_sql_in_condition ("customer_id" , customer_ids )
8387 .add_sql_visibility_condition (visible_only )
@@ -87,6 +91,7 @@ def find_all(
8791 tenant_id_value = self .find_partition_key_value (event_context )
8892 result = self .container .query_items (
8993 query = query_str ,
94+ parameters = params ,
9095 partition_key = tenant_id_value ,
9196 )
9297 function_mapper = self .get_mapper_or_dict (mapper )
@@ -120,18 +125,12 @@ def get_all(
120125 ]
121126
122127 conditions = conditions if conditions else {}
123- customers_ids_conditions = [v for k , v in conditions .items ()]
124-
125- customers_ids_conditions = (
126- customers_ids_conditions + customers_id
127- if customers_id
128- else customers_ids_conditions
129- )
130128
131129 projects = self .repository .find_all (
132130 event_context = event_ctx ,
131+ conditions = conditions ,
133132 project_ids = project_ids ,
134- customer_ids = customers_ids_conditions ,
133+ customer_ids = customers_id ,
135134 )
136135
137136 add_customer_name_to_projects (projects , customers )
0 commit comments