201 előtti mentés

This commit is contained in:
Roo
2026-03-26 07:09:44 +00:00
parent 89668a9beb
commit 03258db091
124 changed files with 13619 additions and 13347 deletions

View File

@@ -37,7 +37,7 @@ async def get_monthly_trends(vehicle_id: str, db: AsyncSession = Depends(get_db)
Visszaadja az utolsó 6 hónap költéseit havi bontásban.
"""
query = text("""
SELECT
SELECT
TO_CHAR(date, 'YYYY-MM') as month,
SUM(amount) as monthly_total
FROM vehicle.vehicle_expenses
@@ -47,4 +47,19 @@ async def get_monthly_trends(vehicle_id: str, db: AsyncSession = Depends(get_db)
LIMIT 6
""")
result = await db.execute(query, {"v_id": vehicle_id})
return [dict(row._mapping) for row in result.fetchall()]
return [dict(row._mapping) for row in result.fetchall()]
@router.get("/summary/latest")
async def get_latest_summary(db: AsyncSession = Depends(get_db), current_user = Depends(get_current_user)):
"""
Returns a simple summary for the dashboard (mock data for now).
This endpoint is called by the frontend dashboard.
"""
# For now, return mock data to satisfy the frontend
return {
"total_vehicles": 4,
"total_cost_this_month": 1250.50,
"most_expensive_category": "Fuel",
"trend": "down",
"trend_percentage": -5.2
}