Implement database-driven feature gating with contextual upgrade prompts: - Add Feature model with 30 features across 8 categories - Create FeatureService with caching for tier-based feature checking - Add @require_feature decorator and RequireFeature dependency for backend enforcement - Create vendor features API (6 endpoints) and admin features API - Add Alpine.js feature store and upgrade prompts store for frontend - Create Jinja macros: feature_gate, feature_locked, limit_warning, usage_bar - Add usage API for tracking orders/products/team limits with upgrade info - Fix Stripe webhook to create VendorAddOn records on addon purchase - Integrate upgrade prompts into vendor dashboard with tier badge and usage bars 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
203 lines
6.1 KiB
Python
203 lines
6.1 KiB
Python
# app/api/v1/admin/__init__.py
|
|
"""
|
|
Admin API router aggregation.
|
|
|
|
This module combines all admin-related JSON API endpoints:
|
|
- Authentication (login/logout)
|
|
- Vendor management (CRUD, bulk operations)
|
|
- Vendor domains management (custom domains, DNS verification)
|
|
- Vendor themes management (theme editor, presets)
|
|
- User management (status, roles)
|
|
- Dashboard and statistics
|
|
- Marketplace monitoring
|
|
- Audit logging
|
|
- Platform settings
|
|
- Notifications and alerts
|
|
- Code quality and architecture validation
|
|
|
|
IMPORTANT:
|
|
- This router is for JSON API endpoints only
|
|
- HTML page routes are mounted separately in main.py at /vendor/*
|
|
- Do NOT include pages.router here - it causes route conflicts
|
|
"""
|
|
|
|
from fastapi import APIRouter
|
|
|
|
# Import all admin routers
|
|
from . import (
|
|
audit,
|
|
auth,
|
|
background_tasks,
|
|
code_quality,
|
|
companies,
|
|
content_pages,
|
|
customers,
|
|
dashboard,
|
|
features,
|
|
images,
|
|
inventory,
|
|
letzshop,
|
|
logs,
|
|
marketplace,
|
|
messages,
|
|
monitoring,
|
|
notifications,
|
|
order_item_exceptions,
|
|
orders,
|
|
platform_health,
|
|
products,
|
|
settings,
|
|
subscriptions,
|
|
tests,
|
|
users,
|
|
vendor_domains,
|
|
vendor_products,
|
|
vendor_themes,
|
|
vendors,
|
|
)
|
|
|
|
# Create admin router
|
|
router = APIRouter()
|
|
|
|
|
|
# ============================================================================
|
|
# Authentication & Authorization
|
|
# ============================================================================
|
|
|
|
# Include authentication endpoints
|
|
router.include_router(auth.router, tags=["admin-auth"])
|
|
|
|
|
|
# ============================================================================
|
|
# Company & Vendor Management
|
|
# ============================================================================
|
|
|
|
# Include company management endpoints
|
|
router.include_router(companies.router, tags=["admin-companies"])
|
|
|
|
# Include vendor management endpoints
|
|
router.include_router(vendors.router, tags=["admin-vendors"])
|
|
|
|
# Include vendor domains management endpoints
|
|
router.include_router(vendor_domains.router, tags=["admin-vendor-domains"])
|
|
|
|
# Include vendor themes management endpoints
|
|
router.include_router(vendor_themes.router, tags=["admin-vendor-themes"])
|
|
|
|
# Include content pages management endpoints
|
|
router.include_router(
|
|
content_pages.router, prefix="/content-pages", tags=["admin-content-pages"]
|
|
)
|
|
|
|
|
|
# ============================================================================
|
|
# User Management
|
|
# ============================================================================
|
|
|
|
# Include user management endpoints
|
|
router.include_router(users.router, tags=["admin-users"])
|
|
|
|
# Include customer management endpoints
|
|
router.include_router(customers.router, tags=["admin-customers"])
|
|
|
|
|
|
# ============================================================================
|
|
# Dashboard & Statistics
|
|
# ============================================================================
|
|
|
|
# Include dashboard and statistics endpoints
|
|
router.include_router(dashboard.router, tags=["admin-dashboard"])
|
|
|
|
|
|
# ============================================================================
|
|
# Vendor Operations (Product Catalog, Inventory & Orders)
|
|
# ============================================================================
|
|
|
|
# Include marketplace product catalog management endpoints
|
|
router.include_router(products.router, tags=["admin-marketplace-products"])
|
|
|
|
# Include vendor product catalog management endpoints
|
|
router.include_router(vendor_products.router, tags=["admin-vendor-products"])
|
|
|
|
# Include inventory management endpoints
|
|
router.include_router(inventory.router, tags=["admin-inventory"])
|
|
|
|
# Include order management endpoints
|
|
router.include_router(orders.router, tags=["admin-orders"])
|
|
|
|
# Include order item exception management endpoints
|
|
router.include_router(
|
|
order_item_exceptions.router, tags=["admin-order-exceptions"]
|
|
)
|
|
|
|
|
|
# ============================================================================
|
|
# Marketplace & Imports
|
|
# ============================================================================
|
|
|
|
# Include marketplace monitoring endpoints
|
|
router.include_router(marketplace.router, tags=["admin-marketplace"])
|
|
|
|
# Include Letzshop integration endpoints
|
|
router.include_router(letzshop.router, tags=["admin-letzshop"])
|
|
|
|
|
|
# ============================================================================
|
|
# Platform Administration
|
|
# ============================================================================
|
|
|
|
# Include background tasks monitoring endpoints
|
|
router.include_router(
|
|
background_tasks.router, prefix="/background-tasks", tags=["admin-background-tasks"]
|
|
)
|
|
|
|
# Include audit logging endpoints
|
|
router.include_router(audit.router, tags=["admin-audit"])
|
|
|
|
# Include platform settings endpoints
|
|
router.include_router(settings.router, tags=["admin-settings"])
|
|
|
|
# Include notifications and alerts endpoints
|
|
router.include_router(notifications.router, tags=["admin-notifications"])
|
|
|
|
# Include messaging endpoints
|
|
router.include_router(messages.router, tags=["admin-messages"])
|
|
|
|
# Include log management endpoints
|
|
router.include_router(logs.router, tags=["admin-logs"])
|
|
|
|
# Include image management endpoints
|
|
router.include_router(images.router, tags=["admin-images"])
|
|
|
|
# Include platform health endpoints
|
|
router.include_router(
|
|
platform_health.router, prefix="/platform", tags=["admin-platform-health"]
|
|
)
|
|
|
|
|
|
# ============================================================================
|
|
# Billing & Subscriptions
|
|
# ============================================================================
|
|
|
|
# Include subscription management endpoints
|
|
router.include_router(subscriptions.router, tags=["admin-subscriptions"])
|
|
|
|
# Include feature management endpoints
|
|
router.include_router(features.router, tags=["admin-features"])
|
|
|
|
|
|
# ============================================================================
|
|
# Code Quality & Architecture
|
|
# ============================================================================
|
|
|
|
# Include code quality and architecture validation endpoints
|
|
router.include_router(
|
|
code_quality.router, prefix="/code-quality", tags=["admin-code-quality"]
|
|
)
|
|
|
|
# Include test runner endpoints
|
|
router.include_router(tests.router, prefix="/tests", tags=["admin-tests"])
|
|
|
|
# Export the router
|
|
__all__ = ["router"]
|