Adding top-level Scopes table

This commit is contained in:
Ian Roddis committed 2026-07-27 14:53:23 -03:00
1 parent bc8b67d585
commit 3febc15a8f
11 files changed
+470 -1

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
"""Top-level, read-only scope fit guide at ``/scopes``.
The site's primary view: a table of scopes with their specs, plus one column per
non-Scope part type listing the accessories that fit each scope.
"""
from fastapi import APIRouter, Depends, Request
from fastapi.responses import HTMLResponse
from sqlalchemy.ext.asyncio import AsyncSession
from app.core.database import get_db
from app.models.user import User
from app.services import scope_guide as scope_guide_service
from app.web.admin import web_require
from app.web.templates import templates
router = APIRouter(include_in_schema=False)
@router.get("/scopes", response_class=HTMLResponse)
async def scopes_page(
request: Request,
db: AsyncSession = Depends(get_db),
user: User = Depends(web_require("augmented_parts:read", "fits:read")),
):
guide = await scope_guide_service.build(db)
return templates.TemplateResponse(
request, "scopes.html", {"user": user, **guide}
)