Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
Ticket purchase: - tickets blueprint with routes for my tickets list, ticket detail with QR - Buy tickets form on entry detail page (HTMX-powered) - Ticket services: create, query, availability checking Admin check-in: - ticket_admin blueprint with dashboard, lookup, and check-in routes - QR scanner/lookup interface with real-time search - Per-entry ticket list view - Check-in transitions ticket state to checked_in Internal API: - GET /internal/events/tickets endpoint for cross-app queries - POST /internal/events/tickets/<code>/checkin for programmatic check-in Template fixes: - All templates updated: blog.post.calendars.* → calendars.* - Removed slug=post.slug parameters (standalone events service) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
65 lines
1.9 KiB
Python
65 lines
1.9 KiB
Python
from __future__ import annotations
|
|
|
|
import path_setup # noqa: F401 # adds shared_lib to sys.path
|
|
|
|
from quart import g
|
|
|
|
from shared.factory import create_base_app
|
|
|
|
from suma_browser.app.bp import register_calendars
|
|
|
|
|
|
async def events_context() -> dict:
|
|
"""
|
|
Events app context processor.
|
|
|
|
- menu_items: fetched from coop internal API
|
|
- cart_count/cart_total: fetched from cart internal API
|
|
"""
|
|
from shared.context import base_context
|
|
from shared.internal_api import get as api_get, dictobj
|
|
|
|
ctx = await base_context()
|
|
|
|
# Menu items from coop API (wrapped for attribute access in templates)
|
|
menu_data = await api_get("coop", "/internal/menu-items")
|
|
ctx["menu_items"] = dictobj(menu_data) if menu_data else []
|
|
|
|
# Cart data from cart API
|
|
cart_data = await api_get("cart", "/internal/cart/summary", forward_session=True)
|
|
if cart_data:
|
|
ctx["cart_count"] = cart_data.get("count", 0)
|
|
ctx["cart_total"] = cart_data.get("total", 0)
|
|
else:
|
|
ctx["cart_count"] = 0
|
|
ctx["cart_total"] = 0
|
|
|
|
return ctx
|
|
|
|
|
|
def create_app() -> "Quart":
|
|
app = create_base_app("events", context_fn=events_context)
|
|
|
|
# Calendars blueprint at root — standalone mode (no post nesting)
|
|
app.register_blueprint(
|
|
register_calendars(),
|
|
url_prefix="/calendars",
|
|
)
|
|
|
|
# Tickets blueprint — user-facing ticket views and QR codes
|
|
from .bp.tickets.routes import register as register_tickets
|
|
app.register_blueprint(register_tickets())
|
|
|
|
# Ticket admin — check-in interface (admin only)
|
|
from .bp.ticket_admin.routes import register as register_ticket_admin
|
|
app.register_blueprint(register_ticket_admin())
|
|
|
|
# Internal API (server-to-server, CSRF-exempt)
|
|
from .events_api import register as register_events_api
|
|
app.register_blueprint(register_events_api())
|
|
|
|
return app
|
|
|
|
|
|
app = create_app()
|