Add purchase date picker and sells feature

- Purchase form now includes a date picker (defaults to today)
- New Sell model, CRUD endpoints (/sells), and stats integration
- AddSell and SellList components added to dashboard
- Portfolio chart updated to reflect sells over time

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-06 19:52:24 +02:00
parent 5cf3726f59
commit 5bb67d6663
10 changed files with 367 additions and 11 deletions
+13
View File
@@ -13,6 +13,7 @@ class User(Base):
is_admin = Column(Boolean, default=False, nullable=False, server_default='0')
purchases = relationship("Purchase", back_populates="owner", cascade="all, delete")
sells = relationship("Sell", back_populates="owner", cascade="all, delete")
class Purchase(Base):
@@ -27,6 +28,18 @@ class Purchase(Base):
owner = relationship("User", back_populates="purchases")
class Sell(Base):
__tablename__ = "sells"
id = Column(Integer, primary_key=True, index=True)
btc_amount = Column(Float, nullable=False)
price_eur = Column(Float, nullable=False)
created_at = Column(DateTime, default=datetime.utcnow)
user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
owner = relationship("User", back_populates="sells")
class OHLCCandle(Base):
__tablename__ = "ohlc_candles"