Show last listing update time next to connection status in header
Add last_updated timestamp to /api/status endpoint by querying MAX(last_seen) across both listing tables. Display it in the HealthIndicator as relative time (e.g. "2h ago") with full date/time in the tooltip on hover.
This commit is contained in:
parent
7833bd3ecf
commit
2d6726dcd7
5 changed files with 55 additions and 5 deletions
|
|
@ -139,8 +139,13 @@ async def unhandled_exception_handler(request: Request, exc: Exception) -> JSONR
|
|||
|
||||
|
||||
@app.get("/api/status")
|
||||
async def get_status() -> dict[str, str]:
|
||||
return {"status": "OK"}
|
||||
async def get_status() -> dict[str, str | None]:
|
||||
repository = ListingRepository(engine)
|
||||
last_updated = repository.get_last_updated()
|
||||
return {
|
||||
"status": "OK",
|
||||
"last_updated": last_updated.isoformat() if last_updated else None,
|
||||
}
|
||||
|
||||
|
||||
@app.get("/api/listing")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue