Commit Graph

663 Commits

Author SHA1 Message Date
3ffa89060e fix: correct static file mount order and update architecture validator
- Fix FastAPI static mount order: module statics must come BEFORE main
  /static mount, otherwise the more general mount catches all requests
- Update validate_architecture.py to check self-contained module paths:
  - JS files in app/modules/*/static/{admin,vendor}/js/
  - Templates in app/modules/*/templates/*/{admin,vendor}/
  - TPL-010 now finds module JS files for Alpine variable checking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 22:59:48 +01:00
33072057c2 feat: add module info and configuration pages to admin panel
Add dedicated pages for viewing module details and configuring module
settings. Includes routes, templates, and JS components for module
info page showing features, menu items, dependencies, and self-contained
module paths. Also adds View/Configure navigation buttons to the platform
modules list.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 22:55:12 +01:00
ec4ec045fc feat: complete CMS as fully autonomous self-contained module
Transform CMS from a thin wrapper into a fully self-contained module with
all code living within app/modules/cms/:

Module Structure:
- models/: ContentPage model (canonical location with dynamic discovery)
- schemas/: Pydantic schemas for API validation
- services/: ContentPageService business logic
- exceptions/: Module-specific exceptions
- routes/api/: REST API endpoints (admin, vendor, shop)
- routes/pages/: HTML page routes (admin, vendor)
- templates/cms/: Jinja2 templates (namespaced)
- static/: JavaScript files (admin/vendor)
- locales/: i18n translations (en, fr, de, lb)

Key Changes:
- Move ContentPage model to module with dynamic model discovery
- Create Pydantic schemas package for request/response validation
- Extract API routes from app/api/v1/*/ to module
- Extract page routes from admin_pages.py/vendor_pages.py to module
- Move static JS files to module with dedicated mount point
- Update templates to use cms_static for module assets
- Add module static file mounting in main.py
- Delete old scattered files (no shims - hard errors on old imports)

This establishes the pattern for migrating other modules to be
fully autonomous and independently deployable.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 22:42:46 +01:00
8ff9c39845 feat: add module-specific locale support for i18n
Enhance the self-contained module architecture with locale/translation support:

ModuleDefinition changes:
- Add locales_path attribute for module-specific translations
- Add get_locales_dir() helper method
- Include locales in validate_structure() check

i18n module changes (app/utils/i18n.py):
- Add get_module_locale_dirs() to discover module locales
- Update load_translations() to merge module translations with core
- Module translations namespaced under module code (e.g., cms.title)
- Add _deep_merge() helper for nested dictionary merging
- Add _load_json_file() helper for cleaner JSON loading

CMS module locales:
- Add app/modules/cms/locales/ with translations for all 4 languages
- en.json, fr.json, de.json, lb.json with CMS-specific strings
- Covers: pages, page editing, SEO, navigation, publishing, homepage
  sections, media library, themes, actions, and messages

Usage in templates:
  {{ _("cms.title") }}           -> "Content Management" (en)
  {{ _("cms.pages.create") }}    -> "Créer une page" (fr)
  {{ _("cms.publishing.draft") }} -> "Entwurf" (de)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 21:44:28 +01:00
2ce19e66b1 feat: implement self-contained module architecture (Phase 1 & 2)
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>
2026-01-26 21:35:36 +01:00
4cf37add1b fix: correct icon names in platform-modules.js
Map module icons to available icons in icons.js:
- building-office → office-building
- archive-box → archive
- chat-bubble-left-right → chat
- code-bracket → code
- chart-bar-square → chart-pie
- puzzle (fallback) → puzzle-piece

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 18:25:23 +01:00
c419090531 feat: complete modular platform architecture (Phases 1-5)
Phase 1 - Vendor Router Integration:
- Wire up vendor module routers in app/api/v1/vendor/__init__.py
- Use lazy imports via __getattr__ to avoid circular dependencies

Phase 2 - Extract Remaining Modules:
- Create 6 new module directories: customers, cms, analytics, messaging,
  dev_tools, monitoring
- Each module has definition.py and route wrappers
- Update registry to import from extracted modules

Phase 3 - Database Table Migration:
- Add PlatformModule junction table for auditable module tracking
- Add migration zc2m3n4o5p6q7_add_platform_modules_table.py
- Add modules relationship to Platform model
- Update ModuleService with JSON-to-junction-table migration

Phase 4 - Module-Specific Configuration UI:
- Add /api/v1/admin/module-config/* endpoints
- Add module-config.html template and JS

Phase 5 - Integration Tests:
- Add tests/fixtures/module_fixtures.py
- Add tests/integration/api/v1/admin/test_modules.py
- Add tests/integration/api/v1/modules/test_module_access.py

Architecture fixes:
- Fix JS-003 errors: use ...data() directly in Alpine components
- Fix JS-005 warnings: add init() guards to prevent duplicate init
- Fix API-001 errors: add MenuActionResponse Pydantic model
- Add FE-008 noqa for dynamic number input in template

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 18:19:00 +01:00
f29f1113cd docs: add session note for modular platform architecture
Documents the complete implementation of Phases 1-5:
- Module foundation and registry
- Menu integration and route protection
- Billing, inventory, orders, marketplace module extractions
- Admin UI for module management
- Pending optional next steps

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 22:17:59 +01:00
7ecd554454 feat: add Admin UI for platform module management (Phase 5)
Added a complete Admin UI for managing platform modules:

API endpoints (app/api/v1/admin/modules.py):
- GET /modules - List all available modules
- GET /modules/platforms/{id} - Get platform modules
- PUT /modules/platforms/{id} - Update enabled modules
- POST /modules/platforms/{id}/enable - Enable a module
- POST /modules/platforms/{id}/disable - Disable a module
- POST /modules/platforms/{id}/enable-all - Enable all
- POST /modules/platforms/{id}/disable-optional - Core only

Admin UI:
- New page route: /admin/platforms/{code}/modules
- Template: platform-modules.html
- JavaScript: platform-modules.js
- Link added to platform-detail.html Super Admin section

Features:
- Toggle modules on/off with dependency resolution
- Enable all / Core only bulk actions
- Visual dependency indicators
- Separate sections for core vs optional modules
- Feature list preview per module

Also includes require_menu_access updates to page routes from Phase 2.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 22:08:13 +01:00
9d0dc51de0 feat: extract inventory, orders, and marketplace modules (Phase 4)
Extract three additional modules following the billing module pattern:

Inventory Module (app/modules/inventory/):
- Stock management and tracking
- Inventory locations
- Low stock alerts
- Admin and vendor routes with module access control

Orders Module (app/modules/orders/):
- Order management and fulfillment
- Order item exceptions
- Bulk operations and export
- Admin and vendor routes with module access control

Marketplace Module (app/modules/marketplace/):
- Letzshop integration
- Product sync
- Marketplace import
- Depends on inventory module
- Admin and vendor routes with module access control

Admin router updated:
- Uses module routers with require_module_access dependency
- Legacy router includes commented out
- Routes verified: 15 inventory, 16 orders, 42 marketplace

All 31 module tests passing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 22:02:24 +01:00
c614b7d74c feat: extract billing module with routes (Phase 3)
Create app/modules/billing/ directory structure with:
- definition.py: Module definition with features and menu items
- routes/admin.py: Admin billing routes with module access control
- routes/vendor.py: Vendor billing routes with module access control

Key changes:
- Billing module uses require_module_access("billing") dependency
- Admin router now includes billing module router instead of legacy
- Module registry imports billing_module from extracted location
- Routes have identical functionality but are now module-gated

Module structure pattern for future extractions:
  app/modules/{module}/
  ├── __init__.py
  ├── definition.py (ModuleDefinition + router getters)
  └── routes/
      ├── __init__.py
      ├── admin.py (require_module_access dependency)
      └── vendor.py (require_module_access dependency)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 21:54:42 +01:00
cd65a5992d feat: implement module-based access control (Phase 2)
Add route-level module checking and comprehensive tests.

Dependencies:
- require_module_access(): Direct module check for routes
- Updated require_menu_access(): Check module before visibility
- Clear error messages for module vs visibility restrictions

Tests (31 tests, all passing):
- Module registry validation
- Menu item to module mapping
- ModuleDefinition class methods
- Module enablement with platform config
- Dependency resolution (marketplace→inventory)
- Enable/disable operations with cascading
- Platform code-based lookups

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 21:48:58 +01:00
5be42c5907 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>
2026-01-25 21:42:44 +01:00
899935ab13 fix: add last_login to AdminUserResponse schema and builder
The last_login field was missing from the API response, causing it
to always show empty on the admin user detail page.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:57:17 +01:00
7cd4636d84 fix: reduce stats query limit to 500 to match API max limit
The API endpoint has a max limit of 500 but the stats query was
requesting 1000, causing a 422 validation error.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:55:57 +01:00
f7ca6c0747 refactor: align copy code pattern with rest of components page
Use inline template literals with {% raw %}{% endraw %} and HTML entities
(&quot;) for quotes, consistent with other copy code buttons on the page.
Removed the codeSnippets JS variables.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:53:15 +01:00
2bac4dfc90 fix: restore copy functionality for confirm modal code snippets
Store code snippets as JS variables in components.js and reference them
in the template. This avoids multi-line template literals in HTML
attributes while still providing copy functionality.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:51:49 +01:00
8259949a7a fix: update last_login timestamp on successful login
The last_login field was never being updated. Now it gets set to the
current UTC timestamp when a user successfully logs in.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:49:58 +01:00
3cd4781724 fix: replace problematic code copy buttons with static pre blocks
Multi-line template literals in HTML attributes cause Alpine.js parsing
errors. Replaced @click="copyCode(...)" with static <pre><code> blocks.
Also simplified the x-text expression to use template literals.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:48:46 +01:00
526c20afb8 fix: add created_at and updated_at to _build_admin_response function
The helper function was building the response manually but was missing
the new timestamp fields added to the schema.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:46:26 +01:00
265395b71a fix: escape Jinja2 syntax in components page code snippets
Added {% raw %}{% endraw %} tags around the confirm_modal code snippets
to prevent Jinja2 from interpreting the {{ }} as template tags.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:45:51 +01:00
6780bd7499 fix: add created_at and updated_at to AdminUserResponse schema
The admin user detail page was showing empty dates because the API
response schema was missing the created_at and updated_at fields
that exist on the User model via TimestampMixin.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:44:55 +01:00
9e79a9fd81 docs: add confirm_modal_dynamic documentation to components page
Added documentation and interactive examples for both confirm_modal
and confirm_modal_dynamic macros, showing danger, warning, info variants
and dynamic message capabilities.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:43:13 +01:00
aa6f22e1b3 feat: add confirm_modal_dynamic macro for dynamic confirmation messages
Added a new macro that accepts an Alpine.js expression for the message,
allowing runtime data to be included in confirmation dialogs. Updated
admin-user-edit.html to use this macro for platform removal confirmation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:40:26 +01:00
fe94ec8581 fix: show platform name in removal confirmation modal
Changed from static confirm_modal macro to custom modal with Alpine.js
binding to display the platform name dynamically in the confirmation
message.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:39:11 +01:00
a0e6833a75 fix: use confirm_modal macro instead of browser confirm for platform removal
Replaced the native browser confirm() dialog with the styled confirm_modal
macro for a consistent UI experience when removing platform assignments
from admin users.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:36:31 +01:00
011744966b feat: add dedicated admin user edit page with platform management
The admin user edit page now uses a dedicated template and JS file
that properly matches the /admin/admin-users/{id}/edit URL pattern.
The page allows super admins to:
- Toggle super admin status
- Toggle active status
- Manage platform assignments for platform admins
- Delete admin users

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:32:28 +01:00
7e68b93132 feat: implement admin-users management with super admin restriction
- Add /admin/admin-users routes for managing admin users (super admin only)
- Remove vendor role from user creation form (vendors created via company hierarchy)
- Add admin-users.html and admin-user-detail.html templates
- Add admin-users.js and admin-user-detail.js for frontend logic
- Move database operations to admin_platform_service (list, get, create, delete, toggle status)
- Update sidebar to show Admin Users section only for super admins
- Add isSuperAdmin computed property to init-alpine.js
- Fix /api/v1 prefix issues in JS files (apiClient already adds prefix)
- Update architecture rule JS-012 to catch more variable patterns (url, endpoint, path)
- Replace inline SVGs with $icon() helper in select-platform.html

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:28:46 +01:00
9d28210cf1 test: add tests for platform assignment in user/vendor creation
Unit tests (test_admin_service.py):
- Vendor creation without platforms
- Vendor creation with single platform
- Vendor creation with multiple platforms
- Vendor creation with invalid platform ID (ignored)
- Vendor creation with duplicate code/subdomain (fails)
- Vendor creation with invalid company ID (fails)

Integration tests (test_vendors.py):
- Create vendor via API without platforms
- Create vendor via API with platforms
- Create vendor with duplicate code fails (409)
- Non-admin cannot create vendors (403)

Auth tests (test_auth.py):
- Super admin login includes is_super_admin=true
- Platform admin login includes is_super_admin=false
- Get current super admin info includes is_super_admin

Total: 69 admin platform tests passing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 20:17:36 +01:00
3cbe7e2979 feat: add platform assignment to user and vendor creation forms
User create page:
- When role=admin, show super admin toggle
- If not super admin, show platform multi-select
- Admin users created via /api/v1/admin/admin-users endpoint
- Vendor users created via existing /admin/users endpoint

Vendor create page:
- Add platform selection section
- Vendors can be assigned to multiple platforms on creation
- Update VendorCreate schema to accept platform_ids
- Update AdminService.create_vendor() to create VendorPlatform records

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 19:49:40 +01:00
300f49c5a1 feat: add platform selection frontend for platform admins
Frontend implementation of platform admin flow:
- Update login.js to check for platform selection after login
- Add platform selection page (/admin/select-platform)
- Add platform context indicator in admin header
- Add is_super_admin to UserResponse schema
- Show "Super Admin" badge or platform name with switch option

Platform admins now:
1. Login normally at /admin/login
2. Get redirected to /admin/select-platform if they have multiple platforms
3. See current platform in header with option to switch

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 18:54:59 +01:00
53e05dd497 feat: implement super admin and platform admin roles
Add multi-platform admin authorization system with:
- AdminPlatform junction table for admin-platform assignments
- is_super_admin flag on User model for global admin access
- Platform selection flow for platform admins after login
- JWT token updates to include platform context
- New API endpoints for admin user management (super admin only)
- Auth dependencies for super admin and platform access checks

Includes comprehensive test coverage:
- Unit tests for AdminPlatform model and User admin methods
- Unit tests for AdminPlatformService operations
- Integration tests for admin users API endpoints

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 18:44:49 +01:00
7e39bb0564 fix: resolve homepage sections editor and rendering issues
- Fix sections editor not showing by converting isHomepage getter to property
- Add Alpine Collapse plugin for accordion animations
- Fix Quill editor content not syncing after page load
- Add platform dropdown to content page edit form
- Create shared templates config (app/templates_config.py) with i18n globals
  to make _() translation function available in Jinja2 macros
- Fix pricing template field names (monthly_price → price_monthly)
- Fix translation key (pricing.save_20 → pricing.save_months)
- Add tiers context to CMS homepage route for pricing section
- Fix architecture validation issues (language defaults, inline SVGs → $icon)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 20:03:13 +01:00
8662fcd6da fix: clear legacy admin_token cookie with path=/ on logout
Users who logged in before the path isolation change (path=/ to path=/admin)
may have stale cookies that cause authentication conflicts. This fix ensures
both the old path=/ and new path=/admin cookies are cleared on logout.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 18:59:17 +01:00
dca52d004e feat: implement section-based homepage management system
Add structured JSON sections to ContentPage for multi-language homepage editing:

Database:
- Add `sections` JSON column to content_pages table
- Migration z8i9j0k1l2m3 adds the column

Schema:
- New models/schema/homepage_sections.py with Pydantic schemas
- TranslatableText for language-keyed translations
- HeroSection, FeaturesSection, PricingSection, CTASection

Templates:
- New section partials in app/templates/platform/sections/
- Updated homepage-default.html to render sections dynamically
- Fallback to placeholder content when sections not configured

Service:
- update_homepage_sections() - validate and save all sections
- update_single_section() - update individual section
- get_default_sections() - empty structure for new homepages

API:
- GET /{page_id}/sections - get sections with platform languages
- PUT /{page_id}/sections - update all sections
- PUT /{page_id}/sections/{section_name} - update single section

Admin UI:
- Section editor appears when editing homepage (slug='home')
- Language tabs from platform.supported_languages
- Accordion sections for Hero, Features, Pricing, CTA
- Button/feature card repeaters with add/remove

Also fixes broken line 181 in z4e5f6a7b8c9 migration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 14:31:23 +01:00
3d3b8cae22 feat: add platform detail/edit admin UI and service enhancements
- 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>
2026-01-23 14:08:02 +01:00
d70a9f38d4 fix: resolve architecture validation errors
- Create platform_service.py to move DB queries from platforms.py API
- Create platform.py exceptions for PlatformNotFoundException
- Update platforms.py API to use platform_service
- Update vendor/content_pages.py to use vendor_service
- Add get_vendor_by_id_optional method to VendorService
- Fix platforms.js: add centralized logger and init guard
- Fix content-page-edit.html: use modal macro instead of inline modal

All 21 architecture validation errors resolved.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 18:42:30 +01:00
4f55fe31c8 docs: update documentation for /platforms/ URL routing strategy
- Add multi-platform URL routing section to url-routing/overview.md
- Update multi-platform-cms.md with new request flow diagrams
- Add PlatformContextMiddleware documentation to middleware.md
- Update middleware execution order diagram
- Add Phase 7 (Platform URL Routing Strategy) to implementation plan
- Update platform URL summary tables across all docs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 18:32:03 +01:00
a2407ae418 feat: implement /platforms/ URL prefix routing strategy
- Update middleware to use /platforms/{code}/ prefix for dev routing
- Change DEFAULT_PLATFORM_CODE from 'oms' to 'main'
- Add 'main' platform for main marketing site (wizamart.lu)
- Remove hardcoded /oms and /loyalty routes from main.py
- Update platform_pages.py homepage to handle vendor landing pages

URL structure:
- localhost:9999/ → Main marketing site ('main' platform)
- localhost:9999/platforms/oms/ → OMS platform
- localhost:9999/platforms/loyalty/ → Loyalty platform
- oms.lu/ → OMS platform (production)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 18:25:56 +01:00
3875ad91df fix: add explicit routes for platform path prefixes
Add explicit routes for /oms/ and /loyalty/ to handle path-based
platform routing in development mode. These routes are defined before
the generic /{slug} catch-all to ensure proper matching.

Routes added:
- /oms → redirect to /oms/
- /oms/ → OMS homepage
- /oms/{slug} → OMS content pages
- /loyalty → redirect to /loyalty/
- /loyalty/ → Loyalty homepage
- /loyalty/{slug} → Loyalty content pages

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 16:50:25 +01:00
47f395b15a docs: update implementation plan with Phase 6 commit hash
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 16:46:25 +01:00
32bcbc881d feat: add Loyalty+ platform with pages (Phase 6)
- Add alembic migration for Loyalty platform (z5f6g7h8i9j0)
- Insert platform: code='loyalty', domain='loyalty.lu', path_prefix='loyalty'
- Create platform marketing pages: home, pricing, features, how-it-works
- Create vendor default pages: about, rewards-catalog, terms, privacy
- Update implementation plan to mark Phase 6 complete

Platform routing handled automatically by PlatformContextMiddleware
via path_prefix detection for /loyalty/* URLs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 16:46:15 +01:00
25653b93e1 docs: update implementation plan status to Phase 5 complete
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 16:30:58 +01:00
968002630e feat: complete multi-platform CMS phases 2-5
Phase 2 - OMS Migration & Integration:
- Fix platform_pages.py to use get_platform_page for marketing pages
- Fix shop_pages.py to pass platform_id to content page service calls

Phase 3 - Admin Interface:
- Add platform management API (app/api/v1/admin/platforms.py)
- Add platforms admin page with stats cards
- Add Platforms menu item to admin sidebar
- Update content pages admin with platform filter and four-tab tier system

Phase 4 - Documentation:
- Add comprehensive architecture docs (docs/architecture/multi-platform-cms.md)
- Update implementation plan with completion status

Phase 5 - Vendor Dashboard:
- Add CMS usage API endpoint with tier limits
- Add usage progress bar to vendor content pages
- Add platform-default/{slug} API for preview
- Add View Default button and modal in page editor

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 16:30:31 +01:00
fe49008fef feat: integrate PlatformContextMiddleware and update routes for multi-platform
Phase 2 implementation:
- Register PlatformContextMiddleware in main.py (runs before VendorContextMiddleware)
- Update VendorContextMiddleware to use platform_clean_path
- Update platform homepage route to use three-tier CMS resolution
- Update platform content page routes with platform context
- Update vendor root path handlers with platform_id support

Middleware execution order:
1. LoggingMiddleware
2. PlatformContextMiddleware (detect platform from domain/path)
3. VendorContextMiddleware (detect vendor, uses platform_clean_path)
4. ContextMiddleware
5. LanguageMiddleware
6. ThemeContextMiddleware

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 20:02:38 +01:00
081f81af47 docs: update multi-platform implementation plan with Phase 1 status
- Mark Phase 1 tasks as complete
- Add detailed Phase 2 (OMS Migration) checklist
- Add documentation requirements section
- Add next session checklist for easy continuation
- Include quick reference for three-tier resolution

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 19:55:10 +01:00
408019dbb3 feat: add multi-platform CMS architecture (Phase 1)
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>
2026-01-18 19:49:44 +01:00
4c9b3c4e4b docs: add multi-platform CMS architecture proposals
- Add loyalty program analysis document
- Add multi-platform CMS architecture proposal
- Document three-tier content hierarchy
- Include URL/access patterns for all personas
- Define migration strategy and implementation phases

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 19:32:30 +01:00
013d8e3d10 feat: integrate Quill rich text editor in admin templates
- Add Quill editor to content-page-edit.html
- Add Quill editor to vendor-product-edit.html
- Add Quill snow theme CSS
- Update background-tasks.html and platform-homepage.html templates

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 20:37:54 +01:00
29a3bf3989 fix: add values_callable to SQLAlchemy Enum columns
Add _enum_values helper and values_callable parameter to Enum columns
in message models to ensure proper enum value extraction for database
operations.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 20:37:41 +01:00