refactor(storage): remove duplicate watchlist query

This commit is contained in:
leefer
2026-07-30 12:07:05 +08:00
parent 67e279a1d5
commit e0b065e38b
4 changed files with 17 additions and 19 deletions
+6 -2
View File
@@ -17,6 +17,7 @@ from backend.features.market.insights.dragon import build_dragon_list
from backend.features.market.insights.popularity import build_popularity
from backend.features.market.insights.service import MarketInsightService
from backend.features.market.insights.themes import build_theme_detail, build_theme_library
from backend.features.review.repository import ReviewRepository
SHANGHAI = ZoneInfo("Asia/Shanghai")
@@ -106,7 +107,7 @@ def test_watchlist_rows_are_built_only_from_current_account_entries() -> None:
def test_watchlist_repository_isolates_accounts(tmp_path) -> None:
database = Database(tmp_path / "watchlists.db")
MigrationRunner(database).upgrade(MIGRATIONS)
repository = MarketRepository()
repository = ReviewRepository()
with database.transaction() as connection:
for user_id, username in ((1, "account-a"), (2, "account-b")):
connection.execute(
@@ -342,7 +343,10 @@ def insight_service(tmp_path, dynamic_available: bool = True) -> MarketInsightSe
payload=prior,
)
return MarketInsightService(
database, repository, AuctionGateway(dynamic_available) # type: ignore[arg-type]
database,
repository,
ReviewRepository(),
AuctionGateway(dynamic_available), # type: ignore[arg-type]
)