Files
orion/app/api/main.py
Samir Boulahtit fb3aa89086 feat: add CMS service layer and API endpoints
Implement complete CMS business logic and REST API:

Service Layer (content_page_service.py):
- get_page_for_vendor() - Two-tier lookup with fallback
- list_pages_for_vendor() - Merge vendor + platform pages
- create_page(), update_page(), delete_page() - CRUD operations
- Support for published/draft workflow
- Footer/header navigation filtering

API Endpoints:

Admin API (/api/v1/admin/content-pages):
- POST /platform - Create platform defaults
- GET /platform - List platform defaults
- GET / - List all pages with vendor filtering
- PUT /{id} - Update any page
- DELETE /{id} - Delete any page

Vendor API (/api/v1/vendor/{code}/content-pages):
- GET / - List available pages (vendor + platform merged)
- GET /overrides - List only vendor overrides
- POST / - Create vendor override
- PUT /{id} - Update vendor page
- DELETE /{id} - Delete vendor page

Shop API (/api/v1/shop/content-pages):
- GET /navigation - Get footer/header navigation pages
- GET /{slug} - Get specific page (public, with fallback)

All endpoints include proper authentication, authorization,
and validation using Pydantic schemas.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 15:54:48 +01:00

60 lines
1.6 KiB
Python

# app/api/main.py
"""
API router configuration for multi-tenant ecommerce platform.
This module provides:
- API version 1 route aggregation
- Route organization by user type (admin, vendor, public)
- Proper route prefixing and tagging
"""
from fastapi import APIRouter
from app.api.v1 import admin, vendor, public, shop
api_router = APIRouter()
# ============================================================================
# ADMIN ROUTES (Platform-level management)
# Prefix: /api/v1/admin
# ============================================================================
api_router.include_router(
admin.router,
prefix="/v1/admin",
tags=["admin"]
)
# ============================================================================
# VENDOR ROUTES (Vendor-scoped operations)
# Prefix: /api/v1/vendor
# ============================================================================
api_router.include_router(
vendor.router,
prefix="/v1/vendor",
tags=["vendor"]
)
# ============================================================================
# PUBLIC/CUSTOMER ROUTES (Customer-facing)
# Prefix: /api/v1/public
# ============================================================================
api_router.include_router(
public.router,
prefix="/v1/public",
tags=["public"]
)
# ============================================================================
# SHOP ROUTES (Public shop frontend API)
# Prefix: /api/v1/shop
# ============================================================================
api_router.include_router(
shop.router,
prefix="/v1/shop",
tags=["shop"]
)