mirror of
https://github.com/stardrophere/InsightRadar.git
synced 2026-06-05 23:56:36 +08:00
update
This commit is contained in:
@@ -21,6 +21,7 @@ class HeadlineRevisionResponse(BaseModel):
|
||||
revised_headline: str
|
||||
source_name: Optional[str] = None
|
||||
platform_icon: Optional[str] = None
|
||||
url: Optional[str] = None
|
||||
created_at: datetime
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
@@ -39,7 +40,7 @@ def list_headline_revisions(
|
||||
time_limit = utcnow() - timedelta(hours=hours)
|
||||
|
||||
rows = (
|
||||
db.query(HeadlineRevision, InfoSource.source_name)
|
||||
db.query(HeadlineRevision, InfoSource.source_name, TrendingEvent.event_url)
|
||||
.join(TrendingEvent, HeadlineRevision.event_id == TrendingEvent.id)
|
||||
.join(InfoSource, TrendingEvent.source_id == InfoSource.id)
|
||||
.filter(HeadlineRevision.created_at >= time_limit)
|
||||
@@ -59,7 +60,7 @@ def list_headline_revisions(
|
||||
}
|
||||
|
||||
results: list[HeadlineRevisionResponse] = []
|
||||
for revision, source_name in rows:
|
||||
for revision, source_name, event_url in rows:
|
||||
results.append(
|
||||
HeadlineRevisionResponse(
|
||||
id=revision.id,
|
||||
@@ -68,6 +69,7 @@ def list_headline_revisions(
|
||||
revised_headline=revision.revised_headline,
|
||||
source_name=source_name,
|
||||
platform_icon=icon_map.get(source_name, "newspaper"),
|
||||
url=event_url,
|
||||
created_at=revision.created_at,
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user