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>
This commit is contained in:
2026-01-19 16:30:31 +01:00
parent fe49008fef
commit 968002630e
19 changed files with 1424 additions and 99 deletions

View File

@@ -1,8 +1,12 @@
# Multi-Platform CMS Architecture - Implementation Plan
> **Status:** Phase 1 Complete | Phases 2-6 Pending
> **Last Updated:** 2026-01-18
> **Commit:** `408019d` (feat: add multi-platform CMS architecture Phase 1)
> **Status:** Phases 1-4 Complete | Phase 5 Pending
> **Last Updated:** 2026-01-19
> **Commits:**
> - `408019d` (Phase 1: Database & Models)
> - Phase 2: OMS Migration & Integration
> - Phase 3: Admin Interface
> - Phase 4: Vendor Dashboard
---
@@ -32,7 +36,7 @@ Transform the single-platform OMS into a multi-platform system supporting indepe
---
## Phase 2: OMS Migration & Integration 🔄 NEXT
## Phase 2: OMS Migration & Integration ✅ COMPLETE
### 2.1 Run Database Migration
@@ -109,42 +113,57 @@ Files to update:
---
## Phase 3: Admin Interface
## Phase 3: Admin Interface ✅ COMPLETE
### 3.1 Platform Management UI
New routes needed:
- [ ] `GET /admin/platforms` - List all platforms
- [ ] `GET /admin/platforms/{code}` - Platform details
- [ ] `GET /admin/platforms/{code}/pages` - Platform marketing pages
- [ ] `GET /admin/platforms/{code}/defaults` - Vendor default pages
- [ ] `POST/PUT/DELETE` endpoints for CRUD operations
| Task | File | Status |
|------|------|--------|
| Platform list page route | `app/routes/admin_pages.py` | ✅ |
| Platform detail/edit routes | `app/routes/admin_pages.py` | ✅ |
| Platform API endpoints | `app/api/v1/admin/platforms.py` | ✅ |
| Register API router | `app/api/v1/admin/__init__.py` | ✅ |
| Platforms template | `app/templates/admin/platforms.html` | ✅ |
| Platforms JS component | `static/admin/js/platforms.js` | ✅ |
| Sidebar menu item | `app/templates/admin/partials/sidebar.html` | ✅ |
### 3.2 Update Content Pages Admin
Changes to existing admin:
- [ ] Add platform dropdown filter
- [ ] Show page tier badge (Platform / Default / Override)
- [ ] Add `is_platform_page` toggle for platform-level pages
- [ ] Group pages by tier in list view
| Task | File | Status |
|------|------|--------|
| Platform dropdown filter | `app/templates/admin/content-pages.html` | ✅ |
| Four-tab tier view | `app/templates/admin/content-pages.html` | ✅ |
| Tier badges (Blue/Teal/Purple) | `static/admin/js/content-pages.js` | ✅ |
| Platform filter in JS | `static/admin/js/content-pages.js` | ✅ |
| API schema with platform fields | `app/api/v1/admin/content_pages.py` | ✅ |
| Model to_dict with platform_name | `models/database/content_page.py` | ✅ |
---
## Phase 4: Vendor Dashboard
## Phase 4: Vendor Dashboard ✅ COMPLETE
### 4.1 Content Pages List Updates
- [ ] Show source indicator: "Default" / "Override" / "Custom"
- [ ] Add "Override Default" button for vendor default pages
- [ ] Add "Revert to Default" button for vendor overrides
- [ ] Show CMS usage: "3 of 10 pages used" with progress bar
- [ ] Upgrade prompt when approaching limit
| Task | File | Status |
|------|------|--------|
| Source indicators (Default/Override/Custom) | `app/templates/vendor/content-pages.html` | ✅ Already existed |
| Override Default button | `app/templates/vendor/content-pages.html` | ✅ Already existed |
| Revert to Default (delete override) | `static/vendor/js/content-pages.js` | ✅ Already existed |
| CMS usage API endpoint | `app/api/v1/vendor/content_pages.py` | ✅ New |
| CMS usage progress bar | `app/templates/vendor/content-pages.html` | ✅ New |
| Upgrade prompt at 80% limit | `app/templates/vendor/content-pages.html` | ✅ New |
| Load usage in JS | `static/vendor/js/content-pages.js` | ✅ New |
### 4.2 Page Editor Updates
- [ ] Show banner: "This page overrides the platform default"
- [ ] "View Default" button to preview default content
- [ ] "Revert" button inline in editor
| Task | File | Status |
|------|------|--------|
| Override info banner | `app/templates/vendor/content-page-edit.html` | ✅ Already existed |
| View Default button | `app/templates/vendor/content-page-edit.html` | ✅ New |
| Default preview modal | `app/templates/vendor/content-page-edit.html` | ✅ New |
| Platform default API | `app/api/v1/vendor/content_pages.py` | ✅ New |
| Show default preview JS | `static/vendor/js/content-page-edit.js` | ✅ New |
| Revert button (styled) | `app/templates/vendor/content-page-edit.html` | ✅ New |
---
@@ -202,30 +221,32 @@ VALUES ('loyalty', 'Loyalty+', 'Customer loyalty program', 'loyalty.lu', 'loyalt
---
## Documentation Requirements
## Documentation Requirements ✅ PARTIAL
### Architecture Documentation
### Architecture Documentation ✅ COMPLETE
Create `docs/architecture/multi-platform-cms.md`:
- [ ] Three-tier content hierarchy explanation
- [ ] Platform vs Vendor Default vs Vendor Override
- [ ] Database schema diagrams
- [ ] Request flow diagrams
Created `docs/architecture/multi-platform-cms.md`:
- [x] Three-tier content hierarchy explanation
- [x] Platform vs Vendor Default vs Vendor Override
- [x] Database schema diagrams
- [x] Request flow diagrams
- [x] API endpoints reference
- [x] Key files reference
- [x] Adding new platform guide
### API Documentation
Update OpenAPI specs:
- [ ] Platform endpoints
- [ ] Content page endpoints with platform_id
- [ ] Vendor platform membership endpoints
OpenAPI specs auto-generated from FastAPI:
- [x] Platform endpoints (`/api/v1/admin/platforms`)
- [x] Content page endpoints with platform fields
- [ ] Vendor platform membership endpoints (future)
### Developer Guide
Create `docs/guides/adding-new-platform.md`:
- [ ] Step-by-step platform creation
- [ ] Required database records
- [ ] Required config files
- [ ] Required routes and templates
Included in `docs/architecture/multi-platform-cms.md`:
- [x] Step-by-step platform creation
- [x] Required database records
- [x] Key files reference
---