Implement the foundation for multi-platform support allowing independent business offerings (OMS, Loyalty, etc.) with their own CMS pages. Database Models: - Add Platform model for business offerings (domain, branding, config) - Add VendorPlatform junction table for many-to-many relationship - Update SubscriptionTier with platform_id and CMS limits - Update ContentPage with platform_id, is_platform_page for three-tier hierarchy - Add CMS feature codes (cms_basic, cms_custom_pages, cms_templates, etc.) Three-Tier Content Resolution: 1. Vendor override (platform_id + vendor_id + slug) 2. Vendor default (platform_id + vendor_id=NULL + is_platform_page=False) 3. Platform marketing pages (is_platform_page=True) New Components: - PlatformContextMiddleware for detecting platform from domain/path - ContentPageService updated with full three-tier resolution - Platform folder structure (app/platforms/oms/, app/platforms/loyalty/) - Alembic migration with backfill for existing data Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
98 lines
2.4 KiB
Python
98 lines
2.4 KiB
Python
# app/platforms/shared/base_platform.py
|
|
"""
|
|
Base Platform Configuration
|
|
|
|
Provides a base class for platform-specific configurations.
|
|
Each platform (OMS, Loyalty, etc.) should extend this class.
|
|
"""
|
|
|
|
from abc import ABC, abstractmethod
|
|
from typing import Any
|
|
|
|
|
|
class BasePlatformConfig(ABC):
|
|
"""
|
|
Base configuration class for platforms.
|
|
|
|
Each platform should create a config.py that extends this class
|
|
and provides platform-specific settings.
|
|
"""
|
|
|
|
@property
|
|
@abstractmethod
|
|
def code(self) -> str:
|
|
"""Unique platform code (e.g., 'oms', 'loyalty')."""
|
|
pass
|
|
|
|
@property
|
|
@abstractmethod
|
|
def name(self) -> str:
|
|
"""Display name (e.g., 'Wizamart OMS')."""
|
|
pass
|
|
|
|
@property
|
|
def description(self) -> str:
|
|
"""Platform description."""
|
|
return ""
|
|
|
|
@property
|
|
def default_language(self) -> str:
|
|
"""Default language code."""
|
|
return "fr"
|
|
|
|
@property
|
|
def supported_languages(self) -> list[str]:
|
|
"""List of supported language codes."""
|
|
return ["fr", "de", "en"]
|
|
|
|
@property
|
|
def theme_defaults(self) -> dict[str, Any]:
|
|
"""Default theme configuration."""
|
|
return {
|
|
"primary_color": "#6366f1",
|
|
"secondary_color": "#8b5cf6",
|
|
"font_family": "Inter, sans-serif",
|
|
}
|
|
|
|
@property
|
|
def features(self) -> list[str]:
|
|
"""List of feature codes enabled for this platform."""
|
|
return []
|
|
|
|
@property
|
|
def marketing_page_slugs(self) -> list[str]:
|
|
"""
|
|
Slugs that should be treated as platform marketing pages.
|
|
|
|
These pages describe the platform itself (pricing, features, etc.)
|
|
rather than being vendor storefront content.
|
|
"""
|
|
return [
|
|
"home",
|
|
"platform_homepage",
|
|
"pricing",
|
|
"about",
|
|
"contact",
|
|
"faq",
|
|
"terms",
|
|
"privacy",
|
|
"features",
|
|
"integrations",
|
|
]
|
|
|
|
@property
|
|
def vendor_default_page_slugs(self) -> list[str]:
|
|
"""
|
|
Slugs for default vendor storefront pages.
|
|
|
|
These pages provide fallback content for vendors who haven't
|
|
customized their storefront.
|
|
"""
|
|
return [
|
|
"about",
|
|
"shipping",
|
|
"returns",
|
|
"privacy-policy",
|
|
"terms-of-service",
|
|
]
|