This is the initial push of the outline of the life dashboard
This commit is contained in:
26
backend/app/models/finance.py
Normal file
26
backend/app/models/finance.py
Normal file
@@ -0,0 +1,26 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user