@@ -163,6 +163,7 @@ def find_all(
163
163
conditions : dict = {},
164
164
custom_sql_conditions : List [str ] = [],
165
165
date_range : dict = {},
166
+ ** kwargs ,
166
167
):
167
168
custom_sql_conditions .append (
168
169
self .create_sql_date_range_filter (date_range )
@@ -175,6 +176,7 @@ def find_all(
175
176
conditions = conditions ,
176
177
custom_sql_conditions = custom_sql_conditions ,
177
178
custom_params = custom_params ,
179
+ max_count = kwargs .get ("max_count" , None ),
178
180
)
179
181
180
182
if time_entries :
@@ -198,6 +200,8 @@ def find_all(
198
200
199
201
users = AzureConnection ().users ()
200
202
add_user_email_to_time_entries (time_entries , users )
203
+ elif not time_entries and len (conditions ) > 1 :
204
+ abort (HTTPStatus .NOT_FOUND , "Time entry not found" )
201
205
return time_entries
202
206
203
207
def on_create (self , new_item_data : dict , event_context : EventContext ):
@@ -381,11 +385,14 @@ def get_all(self, conditions: dict = None, **kwargs) -> list:
381
385
HTTPStatus .FORBIDDEN , "You don't have enough permissions."
382
386
)
383
387
date_range = self .handle_date_filter_args (args = conditions )
388
+ limit = conditions .get ("limit" , None )
389
+ conditions .pop ("limit" , None )
384
390
return self .repository .find_all (
385
391
event_ctx ,
386
392
conditions = conditions ,
387
393
custom_sql_conditions = custom_query ,
388
394
date_range = date_range ,
395
+ max_count = limit ,
389
396
)
390
397
391
398
def get (self , id ):
0 commit comments