fix: restore missing API endpoints, fix chart rendering, and update date filter formatting

This commit is contained in:
2026-04-08 21:25:59 -04:00
parent 532a4e2dc5
commit 6c2478ede3
5 changed files with 27 additions and 5 deletions

View File

@@ -164,10 +164,12 @@ async def get_logs(
limit: int = Query(50, ge=1, le=1000),
offset: int = Query(0, ge=0),
search: Optional[str] = None,
start_time: Optional[str] = None,
end_time: Optional[str] = None,
current_user: str = Depends(get_current_user)
) -> dict[str, Any]:
_logs: list[dict[str, Any]] = await repo.get_logs(limit=limit, offset=offset, search=search)
_total: int = await repo.get_total_logs(search=search)
_logs: list[dict[str, Any]] = await repo.get_logs(limit=limit, offset=offset, search=search, start_time=start_time, end_time=end_time)
_total: int = await repo.get_total_logs(search=search, start_time=start_time, end_time=end_time)
return {
"total": _total,
"limit": limit,
@@ -176,6 +178,17 @@ async def get_logs(
}
@app.get("/api/v1/logs/histogram")
async def get_logs_histogram(
search: Optional[str] = None,
start_time: Optional[str] = None,
end_time: Optional[str] = None,
interval_minutes: int = Query(15, ge=1),
current_user: str = Depends(get_current_user)
) -> list[dict[str, Any]]:
return await repo.get_log_histogram(search=search, start_time=start_time, end_time=end_time, interval_minutes=interval_minutes)
class StatsResponse(BaseModel):
total_logs: int
unique_attackers: int