Full-stack self-hosted finance app with FastAPI backend and React frontend. Features: - Accounts, transactions, budgets, investments with GBP base currency - CSV import with auto-detection for 10 UK bank formats - ML predictions: spending forecast, net worth projection, Monte Carlo - 7 selectable themes (Obsidian, Arctic, Midnight, Vault, Terminal, Synthwave, Ledger) - Receipt/document attachments on transactions (JPEG, PNG, WebP, PDF) - AES-256-GCM field encryption, RS256 JWT, TOTP 2FA, RLS, audit log - Encrypted nightly backups + key rotation script - Mobile-responsive layout with bottom nav Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
23 lines
1.1 KiB
Python
23 lines
1.1 KiB
Python
import uuid
|
|
from datetime import date, datetime
|
|
from decimal import Decimal
|
|
|
|
from sqlalchemy import Date, DateTime, ForeignKey, Numeric, String
|
|
from sqlalchemy.dialects.postgresql import JSONB, UUID
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.db.base import Base
|
|
|
|
|
|
class NetWorthSnapshot(Base):
|
|
__tablename__ = "net_worth_snapshots"
|
|
|
|
id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
|
user_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), ForeignKey("users.id", ondelete="CASCADE"), nullable=False)
|
|
date: Mapped[date] = mapped_column(Date, nullable=False)
|
|
total_assets: Mapped[Decimal] = mapped_column(Numeric(20, 8), nullable=False)
|
|
total_liabilities: Mapped[Decimal] = mapped_column(Numeric(20, 8), nullable=False)
|
|
net_worth: Mapped[Decimal] = mapped_column(Numeric(20, 8), nullable=False)
|
|
base_currency: Mapped[str] = mapped_column(String(10), nullable=False)
|
|
breakdown: Mapped[dict] = mapped_column(JSONB, default=dict, nullable=False)
|
|
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False)
|