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>
59 lines
1.7 KiB
Python
59 lines
1.7 KiB
Python
import uuid
|
|
from datetime import datetime
|
|
from decimal import Decimal
|
|
from typing import Literal
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
AccountType = Literal[
|
|
"checking", "savings", "cash_isa", "stocks_shares_isa",
|
|
"credit_card", "investment", "cash", "crypto_wallet",
|
|
"loan", "mortgage", "pension", "other"
|
|
]
|
|
|
|
|
|
class AccountCreate(BaseModel):
|
|
name: str = Field(..., min_length=1, max_length=100)
|
|
institution: str | None = None
|
|
type: AccountType
|
|
currency: str = Field(default="GBP", min_length=3, max_length=10)
|
|
credit_limit: Decimal | None = None
|
|
interest_rate: Decimal | None = None
|
|
include_in_net_worth: bool = True
|
|
color: str = Field(default="#6366f1", pattern=r"^#[0-9a-fA-F]{6}$")
|
|
icon: str | None = None
|
|
notes: str | None = None
|
|
opening_balance: Decimal = Field(default=Decimal("0"))
|
|
|
|
|
|
class AccountUpdate(BaseModel):
|
|
name: str | None = Field(default=None, min_length=1, max_length=100)
|
|
institution: str | None = None
|
|
opening_balance: Decimal | None = None
|
|
credit_limit: Decimal | None = None
|
|
interest_rate: Decimal | None = None
|
|
include_in_net_worth: bool | None = None
|
|
is_active: bool | None = None
|
|
color: str | None = Field(default=None, pattern=r"^#[0-9a-fA-F]{6}$")
|
|
icon: str | None = None
|
|
notes: str | None = None
|
|
|
|
|
|
class AccountResponse(BaseModel):
|
|
id: uuid.UUID
|
|
name: str
|
|
institution: str | None
|
|
type: str
|
|
currency: str
|
|
current_balance: Decimal
|
|
credit_limit: Decimal | None
|
|
interest_rate: Decimal | None
|
|
is_active: bool
|
|
include_in_net_worth: bool
|
|
color: str
|
|
icon: str | None
|
|
notes: str | None
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
model_config = {"from_attributes": True}
|