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.
23 lines
834 B
Python
23 lines
834 B
Python
"""A monthly spending limit for one expense category — compared against
|
|
actual spend for whichever month is being viewed (services/budget_service.py).
|
|
Not month-scoped itself: one limit per category, in effect until changed."""
|
|
from decimal import Decimal
|
|
|
|
from sqlalchemy import ForeignKey, Numeric
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from app.db.base import Base
|
|
from app.models.mixins import TimestampMixin
|
|
|
|
|
|
class Budget(Base, TimestampMixin):
|
|
__tablename__ = "budgets"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True)
|
|
category_id: Mapped[int] = mapped_column(
|
|
ForeignKey("categories.id", ondelete="CASCADE"), nullable=False, unique=True
|
|
)
|
|
monthly_limit: Mapped[Decimal] = mapped_column(Numeric(14, 2), nullable=False)
|
|
|
|
category: Mapped["Category"] = relationship()
|