Server-renderet af FastAPI selv (Jinja2 + vanilla JS/CSS, intet build-step) mod det eksisterende domæneopløste JSON-API fra 8b. GET / viser bestillingssiden når en runde er åben (rundeoverskrift, intro_text, kategori-grupperet vinkatalog med live-beregnet EUR/DKK-total, bestillingsformular), ellers en tilmeldingsside. GET /tilmelding er altid tilgængelig uafhængigt af rundestatus, og GET /afhentning viser rutens meeting_info. Layoutet er modelleret efter den gamle sides bestillingsside. get_current_round's serialiseringslogik er udtrukket til en delt _build_page_info-helper, så JSON-API'et og de nye HTML-sider genbruger nøjagtig samme domæne-/rundeopslag. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
36 lines
991 B
Python
36 lines
991 B
Python
from fastapi import FastAPI
|
|
from fastapi.staticfiles import StaticFiles
|
|
from sqlalchemy import text
|
|
|
|
from app.db import SessionDep
|
|
from app.routers import (
|
|
auth,
|
|
mail_logs,
|
|
mail_templates,
|
|
participants,
|
|
public_orders,
|
|
public_site,
|
|
purchase_rounds,
|
|
webhooks,
|
|
wine_categories,
|
|
wine_offerings,
|
|
)
|
|
|
|
app = FastAPI(title="Vinindkøb Admin API")
|
|
app.mount("/static", StaticFiles(directory="app/static"), name="static")
|
|
app.include_router(auth.router)
|
|
app.include_router(participants.router)
|
|
app.include_router(purchase_rounds.router)
|
|
app.include_router(wine_offerings.router)
|
|
app.include_router(wine_categories.router)
|
|
app.include_router(mail_templates.router)
|
|
app.include_router(mail_logs.router)
|
|
app.include_router(webhooks.router)
|
|
app.include_router(public_orders.router)
|
|
app.include_router(public_site.router)
|
|
|
|
|
|
@app.get("/health")
|
|
def health(session: SessionDep) -> dict:
|
|
session.exec(text("SELECT 1"))
|
|
return {"status": "ok", "database": "ok"}
|