mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-13 02:56:39 +07:00
Aurum — a self-hosted personal finance operating system: cash flow, net worth tracking, budgets, goals, recurring payments, reports, proactive alerts, and a compound-interest returns calculator, all bilingual (RU/EN) and mobile-first. Ships as a three-container Docker Compose stack (Postgres + FastAPI + nginx-served React frontend). See README.md for setup and CONTRIBUTING.md for development.
20 lines
703 B
Python
20 lines
703 B
Python
from fastapi import APIRouter, Depends, Query
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.api.deps import get_session
|
|
from app.schemas.net_worth import NetWorthSummary
|
|
from app.services.net_worth_service import RANGE_DAYS, get_net_worth_summary
|
|
|
|
router = APIRouter(prefix="/net-worth", tags=["net-worth"])
|
|
|
|
_VALID_RANGES = sorted(set(RANGE_DAYS) | {"all"})
|
|
_RANGE_PATTERN = f"^({'|'.join(_VALID_RANGES)})$"
|
|
|
|
|
|
@router.get("/summary", response_model=NetWorthSummary)
|
|
async def read_net_worth_summary(
|
|
range: str = Query(default="30d", pattern=_RANGE_PATTERN),
|
|
session: AsyncSession = Depends(get_session),
|
|
) -> NetWorthSummary:
|
|
return await get_net_worth_summary(session, range)
|