# app/modules/cms/definition.py """ CMS module definition. Defines the CMS module including its features, menu items, route configurations, and self-contained component paths. This is a self-contained module with: - Services: app.modules.cms.services - Models: app.modules.cms.models - Exceptions: app.modules.cms.exceptions - Templates: app.modules.cms.templates (namespaced as cms/) """ from app.modules.base import ModuleDefinition from models.database.admin_menu_config import FrontendType def _get_admin_router(): """Lazy import of admin router to avoid circular imports.""" from app.modules.cms.routes.admin import admin_router return admin_router def _get_vendor_router(): """Lazy import of vendor router to avoid circular imports.""" from app.modules.cms.routes.vendor import vendor_router return vendor_router # CMS module definition - Self-contained module (pilot) cms_module = ModuleDefinition( code="cms", name="Content Management", description="Content pages, media library, and vendor themes.", features=[ "cms_basic", # Basic page editing "cms_custom_pages", # Custom page creation "cms_unlimited_pages", # No page limit "cms_templates", # Page templates "cms_seo", # SEO tools "media_library", # Media file management ], menu_items={ FrontendType.ADMIN: [ "content-pages", # Platform content pages "vendor-themes", # Theme management ], FrontendType.VENDOR: [ "content-pages", # Vendor content pages "media", # Media library ], }, is_core=True, # CMS is a core module - content management is fundamental # Self-contained module configuration is_self_contained=True, services_path="app.modules.cms.services", models_path="app.modules.cms.models", exceptions_path="app.modules.cms.exceptions", # Module templates (namespaced as cms/admin/*.html and cms/vendor/*.html) templates_path="templates", # Module-specific translations (accessible via cms.* keys) locales_path="locales", ) def get_cms_module_with_routers() -> ModuleDefinition: """ Get CMS module with routers attached. This function attaches the routers lazily to avoid circular imports during module initialization. """ cms_module.admin_router = _get_admin_router() cms_module.vendor_router = _get_vendor_router() return cms_module __all__ = ["cms_module", "get_cms_module_with_routers"]