@@ -180,10 +180,7 @@ async def list_group_expenses(
180180 # Get expenses with pagination
181181 skip = (page - 1 ) * limit
182182 expenses_cursor = (
183- self .collection .find (query )
184- .sort ("createdAt" , - 1 )
185- .skip (skip )
186- .limit (limit )
183+ self .collection .find (query ).sort ("createdAt" , - 1 ).skip (skip ).limit (limit )
187184 )
188185 expenses_docs = await expenses_cursor .to_list (None )
189186
@@ -204,9 +201,7 @@ async def list_group_expenses(
204201 }
205202 },
206203 ]
207- summary_result = await self .collection .aggregate (pipeline ).to_list (
208- None
209- )
204+ summary_result = await self .collection .aggregate (pipeline ).to_list (None )
210205 summary = (
211206 summary_result [0 ]
212207 if summary_result
@@ -411,9 +406,7 @@ async def update_expense(
411406 # Continue anyway, as the expense update succeeded
412407
413408 # Return updated expense
414- updated_expense = await self .collection .find_one (
415- {"_id" : expense_obj_id }
416- )
409+ updated_expense = await self .collection .find_one ({"_id" : expense_obj_id })
417410 if not updated_expense :
418411 raise HTTPException (
419412 status_code = 500 , detail = "Failed to retrieve updated expense"
@@ -459,9 +452,7 @@ async def delete_expense(
459452 await self .settlements_collection .delete_many ({"expenseId" : expense_id })
460453
461454 # Delete the expense
462- result = await self .collection .delete_one (
463- {"_id" : ObjectId (expense_id )}
464- )
455+ result = await self .collection .delete_one ({"_id" : ObjectId (expense_id )})
465456 return result .deleted_count > 0
466457
467458 async def calculate_optimized_settlements (
@@ -677,9 +668,7 @@ async def _get_group_summary(
677668 }
678669 },
679670 ]
680- expense_result = await self .collection .aggregate (pipeline ).to_list (
681- None
682- )
671+ expense_result = await self .collection .aggregate (pipeline ).to_list (None )
683672 expense_stats = (
684673 expense_result [0 ]
685674 if expense_result
0 commit comments