feat: complete billing module self-containment
Migrate billing module routes to self-contained structure: - routes/api/admin.py - Admin API endpoints - routes/api/vendor.py - Vendor API endpoints - routes/pages/ - Page routes (placeholder) - models/subscription.py - Subscription model (moved) - schemas/subscription.py - Pydantic schemas (moved) - locales/ - Translations (en, de, fr, lu) Removed legacy route files: - app/modules/billing/routes/admin.py - app/modules/billing/routes/vendor.py Updated __init__.py files to use new structure. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,27 +2,13 @@
|
||||
"""
|
||||
Billing module route registration.
|
||||
|
||||
This module provides functions to register billing routes
|
||||
with module-based access control.
|
||||
This module provides billing routes with module-based access control.
|
||||
|
||||
NOTE: Routers are NOT auto-imported to avoid circular dependencies.
|
||||
Import directly from admin.py or vendor.py as needed:
|
||||
from app.modules.billing.routes.admin import admin_router
|
||||
from app.modules.billing.routes.vendor import vendor_router
|
||||
Structure:
|
||||
- routes/api/ - REST API endpoints
|
||||
- routes/pages/ - HTML page rendering (templates)
|
||||
"""
|
||||
|
||||
# Routers are imported on-demand to avoid circular dependencies
|
||||
# Do NOT add auto-imports here
|
||||
from app.modules.billing.routes.api import admin_router, vendor_router
|
||||
|
||||
__all__ = ["admin_router", "vendor_router"]
|
||||
|
||||
|
||||
def __getattr__(name: str):
|
||||
"""Lazy import routers to avoid circular dependencies."""
|
||||
if name == "admin_router":
|
||||
from app.modules.billing.routes.admin import admin_router
|
||||
return admin_router
|
||||
elif name == "vendor_router":
|
||||
from app.modules.billing.routes.vendor import vendor_router
|
||||
return vendor_router
|
||||
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
||||
|
||||
13
app/modules/billing/routes/api/__init__.py
Normal file
13
app/modules/billing/routes/api/__init__.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# app/modules/billing/routes/api/__init__.py
|
||||
"""
|
||||
Billing module API routes.
|
||||
|
||||
Provides REST API endpoints for subscription and billing management:
|
||||
- Admin API: Subscription tier management, vendor subscriptions, billing history
|
||||
- Vendor API: Subscription status, tier comparison, invoices
|
||||
"""
|
||||
|
||||
from app.modules.billing.routes.api.admin import admin_router
|
||||
from app.modules.billing.routes.api.vendor import vendor_router
|
||||
|
||||
__all__ = ["admin_router", "vendor_router"]
|
||||
18
app/modules/billing/routes/pages/__init__.py
Normal file
18
app/modules/billing/routes/pages/__init__.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# app/modules/billing/routes/pages/__init__.py
|
||||
"""
|
||||
Billing module page routes (HTML rendering).
|
||||
|
||||
Provides Jinja2 template rendering for billing management:
|
||||
- Admin pages: Subscription tiers, subscriptions list, billing history
|
||||
- Vendor pages: Billing dashboard, invoices
|
||||
|
||||
Note: These routes are placeholders. The actual page rendering
|
||||
is currently handled by routes in app/api/v1/ and can be migrated here.
|
||||
"""
|
||||
|
||||
__all__ = []
|
||||
|
||||
|
||||
def __getattr__(name: str):
|
||||
"""Lazy import routers to avoid circular dependencies."""
|
||||
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
||||
Reference in New Issue
Block a user