- Add platform detail and edit admin pages with templates and JS - Add ContentPageService methods: list_all_platform_pages, list_all_vendor_defaults - Deprecate /admin/platform-homepage route (redirects to /admin/platforms) - Add migration to fix content_page nullable columns - Refine platform and vendor context middleware - Add platform context middleware unit tests - Update platforms.js with improved functionality - Add section-based homepage plan documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
97 lines
2.3 KiB
Python
97 lines
2.3 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",
|
|
"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",
|
|
]
|