feat: /scan response 多帶 generated_at,讓前端能顯示資料更新時間

從 Redis 快取內容讀取 fetcher 寫入時的時間戳(ISO8601 +08:00),原本
只放在 debug 區塊沒暴露。ScanResponse model 加對應 Optional[str] 欄位。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-20 11:15:38 +08:00
parent 863036c293
commit 0264a35b8d

View File

@@ -102,6 +102,7 @@ class ScanResponse(BaseModel):
ttl: int ttl: int
count_raw: int count_raw: int
count_filtered: int count_filtered: int
generated_at: Optional[str] = None # fetcher 寫入 Redis 的時間ISO8601 +08:00
items: List[Item] items: List[Item]
debug: Dict[str, Any] debug: Dict[str, Any]
@@ -211,6 +212,7 @@ def scan(req: ScanRequest) -> Any:
"ttl": ttl, "ttl": ttl,
"count_raw": len(items_raw), "count_raw": len(items_raw),
"count_filtered": len(items_filtered), "count_filtered": len(items_filtered),
"generated_at": data.get("generated_at"),
"items": items_filtered, "items": items_filtered,
"debug": debug_info "debug": debug_info
} }