Phase 1 - Foundation: - Add app/modules/contracts/ with Protocol definitions for cross-module communication (ServiceProtocol, ContentServiceProtocol, MediaServiceProtocol) - Enhance app/modules/base.py ModuleDefinition with self-contained module support (is_self_contained, services_path, models_path, etc.) - Update app/templates_config.py with multi-directory template loading using Jinja2 ChoiceLoader for module templates Phase 2 - CMS Pilot Module: - Migrate CMS service to app/modules/cms/services/content_page_service.py - Create app/modules/cms/exceptions.py with CMS-specific exceptions - Configure app/modules/cms/models/ to re-export ContentPage from canonical location (models.database) to avoid circular imports - Update cms_module definition with is_self_contained=True and paths - Add backwards compatibility shims with deprecation warnings: - app/services/content_page_service.py -> app.modules.cms.services - app/exceptions/content_page.py -> app.modules.cms.exceptions Note: SQLAlchemy models remain in models/database/ as the canonical location to avoid circular imports at startup time. Module model packages re-export from the canonical location. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
# app/modules/cms/__init__.py
|
|
"""
|
|
CMS Module - Content Management System.
|
|
|
|
This is a SELF-CONTAINED module that includes:
|
|
- Services: content_page_service (business logic)
|
|
- Models: ContentPage (database model)
|
|
- Exceptions: ContentPageNotFoundException, etc.
|
|
|
|
This module provides:
|
|
- Content pages management (three-tier: platform, vendor default, vendor override)
|
|
- Media library
|
|
- Vendor themes
|
|
- SEO tools
|
|
|
|
Routes:
|
|
- Admin: /api/v1/admin/content-pages/*
|
|
- Vendor: /api/v1/vendor/content-pages/*, /api/v1/vendor/media/*
|
|
|
|
Menu Items:
|
|
- Admin: content-pages, vendor-themes
|
|
- Vendor: content-pages, media
|
|
|
|
Usage:
|
|
# Preferred: Import from module directly
|
|
from app.modules.cms.services import content_page_service
|
|
from app.modules.cms.models import ContentPage
|
|
from app.modules.cms.exceptions import ContentPageNotFoundException
|
|
|
|
# Legacy: Still works via re-export shims (deprecated)
|
|
from app.services.content_page_service import content_page_service
|
|
from models.database.content_page import ContentPage
|
|
"""
|
|
|
|
from app.modules.cms.definition import cms_module
|
|
|
|
__all__ = ["cms_module"]
|