mirror of
https://github.com/stardrophere/InsightRadar.git
synced 2026-06-06 01:57:51 +08:00
40 lines
1010 B
Python
40 lines
1010 B
Python
from pydantic import BaseModel, Field
|
|
from typing import List, Optional
|
|
from datetime import datetime
|
|
|
|
class PlatformTrendResponse(BaseModel):
|
|
source_id: int
|
|
platform_name: str
|
|
headline: str
|
|
url: Optional[str]
|
|
current_ranking: Optional[int]
|
|
ranking_history: List[int]
|
|
|
|
|
|
class UnifiedEventResponse(BaseModel):
|
|
event_id: int
|
|
unified_title: str
|
|
summary: Optional[str]
|
|
hot_score: int
|
|
created_at: datetime
|
|
last_active_at: datetime
|
|
platforms: List[PlatformTrendResponse]
|
|
tags: List[str] = Field(default_factory=list)
|
|
|
|
|
|
class TimelineDataPoint(BaseModel):
|
|
time_label: str
|
|
count: int
|
|
event_ids: List[int] = Field(default_factory=list)
|
|
|
|
class SearchTimelineResponse(BaseModel):
|
|
keyword: str
|
|
timeline: List[TimelineDataPoint]
|
|
events: List[UnifiedEventResponse]
|
|
|
|
class PaginatedUnifiedEventResponse(BaseModel):
|
|
"""分页包装:避免一次性返回全量数据"""
|
|
total: int
|
|
has_more: bool
|
|
data: List[UnifiedEventResponse]
|