feat(03-05): mount Phase 3 API routers on gateway FastAPI app

- Import all 6 Phase 3 routers from shared.api (portal, billing, channels, llm_keys, usage, webhook)
- Add include_router() calls after existing whatsapp_router
- Update module docstring to document portal API endpoints
This commit is contained in:
2026-03-24 00:53:32 -06:00
parent 60c393b137
commit c47cc2f5bf

View File

@@ -3,6 +3,7 @@ Channel Gateway — FastAPI application.
Mounts the slack-bolt AsyncApp as a sub-application at /slack/events. Mounts the slack-bolt AsyncApp as a sub-application at /slack/events.
Registers the WhatsApp webhook router at /whatsapp/webhook. Registers the WhatsApp webhook router at /whatsapp/webhook.
Serves all Phase 3 portal API routes under /api/portal/* and /api/webhooks/*.
Port: 8001 Port: 8001
@@ -10,6 +11,12 @@ Endpoints:
POST /slack/events — Slack Events API webhook (handled by slack-bolt) POST /slack/events — Slack Events API webhook (handled by slack-bolt)
GET /whatsapp/webhook — WhatsApp hub challenge verification GET /whatsapp/webhook — WhatsApp hub challenge verification
POST /whatsapp/webhook — WhatsApp inbound message webhook POST /whatsapp/webhook — WhatsApp inbound message webhook
GET /api/portal/* — Portal management API (tenants, agents, billing, etc.)
GET /api/portal/billing/* — Stripe billing endpoints
GET /api/portal/channels/* — Channel connection endpoints (Slack OAuth, WhatsApp)
GET /api/portal/tenants/{id}/llm-keys — BYO LLM key management
GET /api/portal/usage/* — Usage and cost analytics
POST /api/webhooks/* — Stripe webhook receiver
GET /health — Health check GET /health — Health check
Startup sequence: Startup sequence:
@@ -18,7 +25,8 @@ Startup sequence:
3. Register Slack event handlers 3. Register Slack event handlers
4. Mount slack-bolt request handler at /slack/events 4. Mount slack-bolt request handler at /slack/events
5. Include WhatsApp router 5. Include WhatsApp router
6. Expose /health 6. Include Phase 3 portal API routers
7. Expose /health
""" """
from __future__ import annotations from __future__ import annotations
@@ -32,6 +40,14 @@ from slack_bolt.async_app import AsyncApp
from gateway.channels.slack import register_slack_handlers from gateway.channels.slack import register_slack_handlers
from gateway.channels.whatsapp import whatsapp_router from gateway.channels.whatsapp import whatsapp_router
from shared.api import (
billing_router,
channels_router,
llm_keys_router,
portal_router,
usage_router,
webhook_router,
)
from shared.config import settings from shared.config import settings
from shared.db import async_session_factory from shared.db import async_session_factory
@@ -88,6 +104,16 @@ slack_handler = AsyncSlackRequestHandler(slack_app)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
app.include_router(whatsapp_router) app.include_router(whatsapp_router)
# ---------------------------------------------------------------------------
# Register Phase 3 portal API routers
# ---------------------------------------------------------------------------
app.include_router(portal_router)
app.include_router(billing_router)
app.include_router(channels_router)
app.include_router(llm_keys_router)
app.include_router(usage_router)
app.include_router(webhook_router)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Routes # Routes