fix(news): per-bill URL dedup + lazy re-fetch on bill detail load
- Drop global unique constraint on news_articles.url; replace with (bill_id, url) so the same article can appear for multiple bills - news_fetcher dedup now scoped to bill_id instead of global URL - Bill detail endpoint triggers a background news fetch when no articles are stored, so gnews articles surface on next load Migration 0009. Co-Authored-By: Jack Levy
This commit is contained in:
@@ -50,8 +50,8 @@ def fetch_news_for_bill(self, bill_id: str):
|
||||
url = article.get("url")
|
||||
if not url:
|
||||
continue
|
||||
# Idempotency: skip duplicate URLs
|
||||
existing = db.query(NewsArticle).filter_by(url=url).first()
|
||||
# Idempotency: skip duplicates per bill (same article can appear for multiple bills)
|
||||
existing = db.query(NewsArticle).filter_by(bill_id=bill_id, url=url).first()
|
||||
if existing:
|
||||
continue
|
||||
pub_at = None
|
||||
|
||||
Reference in New Issue
Block a user