mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-14 19:46:40 +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:
54
backend/app/schemas/asset.py
Normal file
54
backend/app/schemas/asset.py
Normal file
@@ -0,0 +1,54 @@
|
||||
from datetime import date as date_
|
||||
from decimal import Decimal
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from app.models.enums import AssetClass, CapitalRole, RiskLevel
|
||||
|
||||
|
||||
class AssetValuationCreate(BaseModel):
|
||||
value: Decimal = Field(ge=0, max_digits=14, decimal_places=2)
|
||||
as_of_date: date_ = Field(default_factory=date_.today)
|
||||
|
||||
|
||||
class AssetValuationRead(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
value: Decimal
|
||||
as_of_date: date_
|
||||
|
||||
|
||||
class AssetBase(BaseModel):
|
||||
name: str = Field(min_length=1, max_length=150)
|
||||
asset_class: AssetClass
|
||||
currency: str = Field(default="USD", min_length=3, max_length=3)
|
||||
notes: str | None = None
|
||||
capital_role: CapitalRole = CapitalRole.NEUTRAL
|
||||
# Rough self-reported monthly net cash flow — informational, not tracked
|
||||
# transactions (see Asset.monthly_cash_flow).
|
||||
monthly_cash_flow: Decimal | None = Field(default=None, max_digits=14, decimal_places=2)
|
||||
risk_level: RiskLevel = RiskLevel.MEDIUM
|
||||
|
||||
|
||||
class AssetCreate(AssetBase):
|
||||
value: Decimal = Field(ge=0, max_digits=14, decimal_places=2)
|
||||
as_of_date: date_ = Field(default_factory=date_.today)
|
||||
|
||||
|
||||
class AssetUpdate(BaseModel):
|
||||
name: str | None = Field(default=None, min_length=1, max_length=150)
|
||||
asset_class: AssetClass | None = None
|
||||
currency: str | None = Field(default=None, min_length=3, max_length=3)
|
||||
notes: str | None = None
|
||||
capital_role: CapitalRole | None = None
|
||||
monthly_cash_flow: Decimal | None = Field(default=None, max_digits=14, decimal_places=2)
|
||||
risk_level: RiskLevel | None = None
|
||||
|
||||
|
||||
class AssetRead(AssetBase):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
current_value: Decimal
|
||||
as_of_date: date_
|
||||
Reference in New Issue
Block a user