File size: 2,610 Bytes
bde2f3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
"""V1 API router aggregator.

The strangle: new v1 routes are added here as domains migrate. The legacy
main.py still mounts all old routes; we ADD new v1 routes on top so they
co-exist until cutover.

To add a new domain:
    1. Create app/api/v1/<group>/<domain>.py with APIRouter
    2. Import and append it to `api_v1_router` below
    3. Mount the route prefix in the domain's __init__.py
"""
from __future__ import annotations

from fastapi import APIRouter

# Aggregator list β€” populated as domains migrate.
# Each entry is an APIRouter from app/api/v1/<group>/<domain>.py.
api_v1_router: list[APIRouter] = []

# Aggregator router β€” single mount point for v1.
# When domains migrate, replace this with a real aggregator:
#     from app.api.v1.public import router as public_router
#     api_v1_router.append(public_router)
router = APIRouter(prefix="/api/v1", tags=["v1"])


# ── Migrated domains ───────────────────────────────────────────────────
# Each migrated domain is imported here. The router exposes endpoints
# at /api/v1/<domain>/* (path defined per-router).
#
# During strangelfig, the LEGACY /api/v1/<domain>/* endpoints remain
# mounted in main.py. The new v1 router is mounted at the same path
# (FastAPI handles prefix-based routing) β€” first match wins, so the
# legacy stays until we explicitly remove it.

from app.api.v1.auth.alerts import router as alerts_router  # noqa: E402

api_v1_router.append(alerts_router)

from app.api.v1.public.wallet import router as wallet_router  # noqa: E402

api_v1_router.append(wallet_router)

from app.api.v1.public.token import router as token_router  # noqa: E402

api_v1_router.append(token_router)

from app.api.v1.public.scanner import router as scanner_router  # noqa: E402

api_v1_router.append(scanner_router)

# x402 moved to app.domain.x402 (T34 v2)
# Old app/api/v1/x402/payments.py removed to avoid model conflicts

from app.api.v1.rag.search import router as rag_v2_router  # noqa: E402

api_v1_router.append(rag_v2_router)

from app.api.v1.admin.alerts_webhook import router as admin_alerts_webhook_router  # noqa: E402

api_v1_router.append(admin_alerts_webhook_router)

from app.api.v1.catalog import router as catalog_router  # noqa: E402

api_v1_router.append(catalog_router)


def build_v1_router() -> APIRouter:
    """Construct the v1 aggregator with all migrated routes mounted."""
    aggregated = APIRouter(prefix="/api/v1")
    for r in api_v1_router:
        aggregated.include_router(r)
    return aggregated