Backend:
- Migrations 013-015: eBay user tokens, monitor settings on saved_searches
(monitor_enabled, poll_interval_min, min_trust_score, last_checked_at),
watch_alerts table with UNIQUE dedup on (saved_search_id, platform_listing_id),
active_monitors registry for cross-user polling
- WatchAlert model + store methods: upsert_alert, list_alerts, dismiss_alert,
count_undismissed_alerts, dismiss_all_alerts, list_active_monitors
- monitor.py: run_monitor_search() using TrustScorer.score_batch(); should_alert()
with BIN/auction/partial-score logic (auction window = 24h, partial +10 buffer)
- PATCH /api/saved-searches/{id}/monitor, GET /api/alerts, POST /api/alerts/*/dismiss
- Background polling loop at startup (asyncio.to_thread every 60s check cycle)
- ebay/adapter.py: enrich_seller_trading_api() via Trading API GetUser (OAuth token)
- nginx: raise proxy_read_timeout to 120s for slow eBay search responses
Frontend:
- AlertBell component: bell button + unread badge + panel with dismiss/clear-all;
polls /api/alerts every 2 minutes; aria-live announcement on count change
- alerts.ts Pinia store: fetchAlerts, dismiss, dismissAll
- SavedSearchesView: monitor toggle + poll interval + min trust score controls
- SettingsView: eBay OAuth connect/disconnect section
- AppNav: AlertBell wired for logged-in and local-tier users
Tests: 24 monitor tests (should_alert branches, store alert CRUD, run_monitor_search
with mocked adapter); fix browser_pool test assertions for new wait_for_* params.
20 lines
848 B
SQL
20 lines
848 B
SQL
-- Migration 015: cross-user monitor registry for the background polling loop
|
|
--
|
|
-- In cloud mode this table lives in shared.db — the polling loop queries it
|
|
-- to find all due monitors without scanning per-user DB files.
|
|
-- In local mode it lives in the single local DB (same result, one user).
|
|
--
|
|
-- user_db_path references the per-user snipe user.db so the poller knows
|
|
-- which DB to open for the full SavedSearch config and to write alerts.
|
|
|
|
CREATE TABLE IF NOT EXISTS active_monitors (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
user_db_path TEXT NOT NULL,
|
|
saved_search_id INTEGER NOT NULL,
|
|
poll_interval_min INTEGER NOT NULL DEFAULT 60,
|
|
last_checked_at TEXT,
|
|
UNIQUE(user_db_path, saved_search_id)
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_active_monitors_due
|
|
ON active_monitors(last_checked_at);
|