Files
aurum/backend/app/schemas/budget.py
ZProger fe9b079c12 Initial public release
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.
2026-08-16 18:39:52 +03:00

46 lines
1012 B
Python

from decimal import Decimal
from pydantic import BaseModel, Field
class BudgetCreate(BaseModel):
category_id: int
monthly_limit: Decimal = Field(gt=0)
class BudgetUpdate(BaseModel):
monthly_limit: Decimal = Field(gt=0)
class BudgetRead(BaseModel):
id: int
category_id: int
category_name: str
category_color: str
category_icon: str | None
monthly_limit: Decimal
class BudgetStatus(BaseModel):
"""One budgeted category's actual spend for a given month, compared
against its limit."""
budget_id: int
category_id: int
category_name: str
category_color: str
category_icon: str | None
monthly_limit: Decimal
spent: Decimal
remaining: Decimal
# Can exceed 100 — the UI clamps the progress bar fill, not this number,
# so "spent 150% of budget" is still visible in the raw value.
percent: float
is_over_budget: bool
class BudgetStatusResponse(BaseModel):
year: int
month: int
items: list[BudgetStatus]