feat: implement modular platform architecture (Phase 1)

Add module system for enabling/disabling feature bundles per platform.

Module System:
- ModuleDefinition dataclass for defining modules
- 12 modules: core, platform-admin, billing, inventory, orders,
  marketplace, customers, cms, analytics, messaging, dev-tools, monitoring
- Core modules (core, platform-admin) cannot be disabled
- Module dependencies (e.g., marketplace requires inventory)

MenuService Integration:
- Menu items filtered by module enablement
- MenuItemConfig includes is_module_enabled and module_code fields
- Module-disabled items hidden from sidebar

Platform Configuration:
- BasePlatformConfig.enabled_modules property
- OMS: all modules enabled (full commerce)
- Loyalty: focused subset (no billing/inventory/orders/marketplace)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-25 21:42:44 +01:00
parent 899935ab13
commit 5be42c5907
8 changed files with 1985 additions and 0 deletions

View File

@@ -3,6 +3,18 @@
Loyalty Platform Configuration
Configuration for the Loyalty/Rewards platform.
Loyalty is a focused customer rewards platform with:
- Customer management and segmentation
- Analytics and reporting
- Content management (for rewards pages)
- Messaging and notifications
It does NOT include:
- Inventory management (no physical products)
- Order processing (rewards are claimed, not purchased)
- Marketplace integration (internal program only)
- Billing (typically internal/free programs)
"""
from app.platforms.shared.base_platform import BasePlatformConfig
@@ -33,6 +45,28 @@ class LoyaltyPlatformConfig(BasePlatformConfig):
"referral_program",
]
@property
def enabled_modules(self) -> list[str]:
"""
Loyalty platform has a focused module set.
Core modules (core, platform-admin) are always included.
Does not include: billing, inventory, orders, marketplace
"""
return [
# Core modules (always enabled, listed for clarity)
"core",
"platform-admin",
# Customer-focused modules
"customers",
"analytics",
"messaging",
# Content for rewards pages
"cms",
# Internal tools (reduced set)
"monitoring",
]
@property
def vendor_default_page_slugs(self) -> list[str]:
"""Default pages for Loyalty vendor storefronts."""

View File

@@ -3,6 +3,15 @@
OMS Platform Configuration
Configuration for the Order Management System platform.
OMS is a full-featured order management system with:
- Inventory and product management
- Order processing and fulfillment
- Letzshop marketplace integration
- Customer management
- Billing and subscriptions
- Content management
- Analytics and reporting
"""
from app.platforms.shared.base_platform import BasePlatformConfig
@@ -34,6 +43,32 @@ class OMSPlatformConfig(BasePlatformConfig):
"customer_view",
]
@property
def enabled_modules(self) -> list[str]:
"""
OMS enables all major commerce modules.
Core modules (core, platform-admin) are always included.
"""
return [
# Core modules (always enabled, listed for clarity)
"core",
"platform-admin",
# Commerce modules
"billing",
"inventory",
"orders",
"marketplace",
"customers",
# Content & communication
"cms",
"analytics",
"messaging",
# Internal tools
"dev-tools",
"monitoring",
]
@property
def vendor_default_page_slugs(self) -> list[str]:
"""Default pages for OMS vendor storefronts."""

View File

@@ -16,6 +16,11 @@ class BasePlatformConfig(ABC):
Each platform should create a config.py that extends this class
and provides platform-specific settings.
Module Configuration:
- enabled_modules: List of module codes to enable for this platform
- Core modules (core, platform-admin) are always enabled
- If not specified, all modules are enabled (backwards compatibility)
"""
@property
@@ -59,6 +64,33 @@ class BasePlatformConfig(ABC):
"""List of feature codes enabled for this platform."""
return []
@property
def enabled_modules(self) -> list[str]:
"""
List of module codes enabled for this platform.
Core modules (core, platform-admin) are always enabled regardless.
Override in subclass to customize which modules are available.
Available modules:
- core (always enabled): Dashboard, settings, profile
- platform-admin (always enabled): Companies, vendors, admin users
- billing: Subscription tiers, billing history
- inventory: Stock management, products
- orders: Order processing, fulfillment
- marketplace: Letzshop integration
- customers: Customer management
- cms: Content pages, media library
- analytics: Reports, dashboard analytics
- messaging: Messages, notifications
- dev-tools: Component library (internal)
- monitoring: Logs, background tasks (internal)
Returns:
List of module codes. Empty list means all modules enabled.
"""
return [] # Empty = all modules enabled (backwards compatibility)
@property
def marketing_page_slugs(self) -> list[str]:
"""