Skip to content

Commit 7b4275c

Browse files
author
jinang
committed
[Tech Debt] Removed Debug Endpoint from production application
1 parent ee32179 commit 7b4275c

File tree

1 file changed

+1
-50
lines changed

1 file changed

+1
-50
lines changed

backend/app/expenses/routes.py

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -459,53 +459,4 @@ async def group_expense_analytics(
459459
except ValueError as e:
460460
raise HTTPException(status_code=404, detail=str(e))
461461
except Exception as e:
462-
raise HTTPException(status_code=500, detail="Failed to fetch analytics")
463-
464-
465-
# Debug endpoint (remove in production)
466-
@router.get("/expenses/{expense_id}/debug")
467-
async def debug_expense(
468-
group_id: str,
469-
expense_id: str,
470-
current_user: Dict[str, Any] = Depends(get_current_user),
471-
):
472-
"""Debug endpoint to check expense details and user permissions"""
473-
try:
474-
from app.database import mongodb
475-
from bson import ObjectId
476-
477-
# Check if expense exists
478-
expense = await mongodb.database.expenses.find_one(
479-
{"_id": ObjectId(expense_id)}
480-
)
481-
if not expense:
482-
return {"error": "Expense not found", "expense_id": expense_id}
483-
484-
# Check group membership
485-
group = await mongodb.database.groups.find_one(
486-
{"_id": ObjectId(group_id), "members.userId": current_user["_id"]}
487-
)
488-
489-
# Check if user created the expense
490-
user_created = expense.get("createdBy") == current_user["_id"]
491-
492-
return {
493-
"expense_exists": True,
494-
"expense_id": expense_id,
495-
"group_id": group_id,
496-
"user_id": current_user["_id"],
497-
"expense_created_by": expense.get("createdBy"),
498-
"user_created_expense": user_created,
499-
"user_in_group": group is not None,
500-
"expense_group_id": expense.get("groupId"),
501-
"group_id_match": expense.get("groupId") == group_id,
502-
"expense_data": {
503-
"description": expense.get("description"),
504-
"amount": expense.get("amount"),
505-
"splits_count": len(expense.get("splits", [])),
506-
"created_at": expense.get("createdAt"),
507-
"updated_at": expense.get("updatedAt"),
508-
},
509-
}
510-
except Exception as e:
511-
return {"error": str(e), "type": type(e).__name__}
462+
raise HTTPException(status_code=500, detail="Failed to fetch analytics")

0 commit comments

Comments
 (0)