from datetime import date, datetime from sqlalchemy import Date, Numeric, Text, func from sqlalchemy.orm import Mapped, mapped_column from app.database import Base class FinanceTransaction(Base): __tablename__ = "finance_transactions" id: Mapped[int] = mapped_column(primary_key=True) date: Mapped[date] = mapped_column(Date) amount: Mapped[float] = mapped_column(Numeric(12, 2)) category: Mapped[str] = mapped_column(Text) description: Mapped[str | None] = mapped_column(Text, nullable=True) created_at: Mapped[datetime] = mapped_column(server_default=func.now()) class FinanceSnapshot(Base): __tablename__ = "finance_snapshots" id: Mapped[int] = mapped_column(primary_key=True) date: Mapped[date] = mapped_column(Date, unique=True) net_worth: Mapped[float] = mapped_column(Numeric(14, 2)) notes: Mapped[str | None] = mapped_column(Text, nullable=True)