feat: add portfolio ownership model, auth guards, and migration

This commit is contained in:
2026-04-14 00:13:34 +09:00
parent e89690b1dd
commit 9787cf3159
22 changed files with 681 additions and 70 deletions
+4 -1
View File
@@ -50,7 +50,9 @@ class FakeRepo:
setattr(portfolio, key, value)
return portfolio
def list_portfolios(self, *, broker=None, status=None):
def list_portfolios(self, *, broker=None, status=None, owner_user_id=None):
if owner_user_id is not None and self._portfolio and self._portfolio.owner_user_id != owner_user_id:
return []
return [self._portfolio] if self._portfolio else []
def get_or_create_strategy_set(self, name: str, config: str) -> StrategySet:
@@ -181,6 +183,7 @@ def _portfolio() -> Portfolio:
status="enabled",
name="Samsung Electronics",
symbol="005930",
owner_user_id="legacy-owner",
cash_balance=1_000_000.0,
asset_quantity=1.0,
price=70_000.0,