Revert "Redesign finance dashboard with period summaries"
This reverts commit 8d41956d88.
This commit is contained in:
@@ -11,7 +11,6 @@ from sqlalchemy.orm import Session
|
||||
from app.database import get_db
|
||||
from app.services.finance_service import (
|
||||
compute_daily_summary,
|
||||
get_finance_summary,
|
||||
get_or_create_daily_summary,
|
||||
overwrite_daily_summary,
|
||||
today_shanghai,
|
||||
@@ -54,26 +53,6 @@ def daily_summary(
|
||||
return get_or_create_daily_summary(db, target)
|
||||
|
||||
|
||||
@router.get("/summary")
|
||||
def finance_summary(
|
||||
period: str = Query("day", description="day | week | month"),
|
||||
date: str | None = Query(None, description="YYYY-MM-DD, defaults to yesterday Asia/Shanghai"),
|
||||
db: Session = Depends(get_db),
|
||||
_: Any = Depends(get_current_user),
|
||||
) -> dict:
|
||||
"""Return finance summary for day/week/month.
|
||||
|
||||
day reuses the existing daily snapshot behavior. week/month aggregate only
|
||||
stored finance_daily_summaries rows and never call upstream services.
|
||||
"""
|
||||
period = period.lower()
|
||||
if period not in {"day", "week", "month"}:
|
||||
raise HTTPException(400, f"Invalid period: {period!r}. Expected day, week, or month.")
|
||||
target = _resolve_date(date)
|
||||
_validate_not_future(target)
|
||||
return get_finance_summary(db, period, target)
|
||||
|
||||
|
||||
@router.post("/daily-summary/compare")
|
||||
def compare_daily_summary(
|
||||
date: str | None = Query(None, description="YYYY-MM-DD, defaults to yesterday Asia/Shanghai"),
|
||||
|
||||
Reference in New Issue
Block a user