Templates Migration: - Migrate admin templates to modules (tenancy, billing, monitoring, marketplace, etc.) - Migrate vendor templates to modules (tenancy, billing, orders, messaging, etc.) - Migrate storefront templates to modules (catalog, customers, orders, cart, checkout, cms) - Migrate public templates to modules (billing, marketplace, cms) - Keep shared templates in app/templates/ (base.html, errors/, partials/, macros/) - Migrate letzshop partials to marketplace module Static Files Migration: - Migrate admin JS to modules: tenancy (23 files), core (5 files), monitoring (1 file) - Migrate vendor JS to modules: tenancy (4 files), core (2 files) - Migrate shared JS: vendor-selector.js to core, media-picker.js to cms - Migrate storefront JS: storefront-layout.js to core - Keep framework JS in static/ (api-client, utils, money, icons, log-config, lib/) - Update all template references to use module_static paths Naming Consistency: - Rename static/platform/ to static/public/ - Rename app/templates/platform/ to app/templates/public/ - Update all extends and static references Documentation: - Update module-system.md with shared templates documentation - Update frontend-structure.md with new module JS organization Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
90 lines
3.2 KiB
Python
90 lines
3.2 KiB
Python
# app/api/v1/admin/__init__.py
|
|
"""
|
|
Admin API router aggregation.
|
|
|
|
This module combines legacy admin routes with auto-discovered module routes.
|
|
|
|
LEGACY ROUTES (defined in app/api/v1/admin/):
|
|
- /menu-config/* - Navigation configuration (super admin)
|
|
- /modules/* - Module management (super admin)
|
|
- /module-config/* - Module settings (super admin)
|
|
|
|
AUTO-DISCOVERED MODULE ROUTES:
|
|
- tenancy: auth, admin_users, users, companies, platforms, vendors, vendor_domains
|
|
- core: dashboard, settings
|
|
- messaging: messages, notifications, email-templates
|
|
- monitoring: logs, tasks, tests, code_quality, audit, platform-health
|
|
- billing: subscriptions, invoices, payments
|
|
- inventory: stock management
|
|
- orders: order management, fulfillment, exceptions
|
|
- marketplace: letzshop integration, product sync
|
|
- catalog: vendor product catalog
|
|
- cms: content-pages, images, media, vendor-themes
|
|
- customers: customer management
|
|
|
|
IMPORTANT:
|
|
- This router is for JSON API endpoints only
|
|
- HTML page routes are mounted separately in main.py
|
|
- Module routes are auto-discovered from app/modules/{module}/routes/api/admin.py
|
|
"""
|
|
|
|
from fastapi import APIRouter
|
|
|
|
# Import all admin routers (legacy routes that haven't been migrated to modules)
|
|
# NOTE: Migrated to modules (auto-discovered):
|
|
# - tenancy: auth, admin_users, users, companies, platforms, vendors, vendor_domains
|
|
# - core: dashboard, settings
|
|
# - messaging: messages, notifications, email_templates
|
|
# - monitoring: logs, tasks, tests, code_quality, audit, platform_health
|
|
# - cms: content_pages, images, media, vendor_themes
|
|
from . import (
|
|
menu_config,
|
|
module_config,
|
|
modules,
|
|
)
|
|
|
|
# Create admin router
|
|
router = APIRouter()
|
|
|
|
|
|
# ============================================================================
|
|
# Framework Config (remain in legacy - super admin only)
|
|
# ============================================================================
|
|
|
|
# Include menu configuration endpoints (super admin only)
|
|
router.include_router(menu_config.router, tags=["admin-menu-config"])
|
|
|
|
# Include module management endpoints (super admin only)
|
|
router.include_router(modules.router, tags=["admin-modules"])
|
|
|
|
# Include module configuration endpoints (super admin only)
|
|
router.include_router(module_config.router, tags=["admin-module-config"])
|
|
|
|
|
|
# ============================================================================
|
|
# Auto-discovered Module Routes
|
|
# ============================================================================
|
|
# Routes from self-contained modules are auto-discovered and registered.
|
|
# Modules include: billing, inventory, orders, marketplace, cms, customers,
|
|
# monitoring (logs, tasks, tests, code_quality, audit, platform_health),
|
|
# messaging (messages, notifications, email_templates)
|
|
|
|
from app.modules.routes import get_admin_api_routes
|
|
|
|
for route_info in get_admin_api_routes():
|
|
# Only pass prefix if custom_prefix is set (router already has internal prefix)
|
|
if route_info.custom_prefix:
|
|
router.include_router(
|
|
route_info.router,
|
|
prefix=route_info.custom_prefix,
|
|
tags=route_info.tags,
|
|
)
|
|
else:
|
|
router.include_router(
|
|
route_info.router,
|
|
tags=route_info.tags,
|
|
)
|
|
|
|
# Export the router
|
|
__all__ = ["router"]
|