mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-13 02:56:39 +07:00
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.
This commit is contained in:
45
backend/app/schemas/budget.py
Normal file
45
backend/app/schemas/budget.py
Normal file
@@ -0,0 +1,45 @@
|
||||
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]
|
||||
Reference in New Issue
Block a user