1
0
mirror of https://github.com/resf/distro-tools.git synced 2024-12-22 18:58:30 +00:00
distro-tools/apollo/server/routes/statistics.py
2023-02-01 22:37:16 +01:00

21 lines
617 B
Python

from fastapi import APIRouter, Request
from fastapi.responses import HTMLResponse
from apollo.db import RedHatAdvisory, Advisory
from apollo.server.utils import templates
router = APIRouter(tags=["non-api"])
@router.get("/", response_class=HTMLResponse)
async def statistics(request: Request):
rh_advisory_count = await RedHatAdvisory.all().count()
advisory_count = await Advisory.all().count()
return templates.TemplateResponse(
"index.jinja", {
"request": request,
"rh_advisory_count": rh_advisory_count,
"advisory_count": advisory_count,
}
)