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>
This commit is contained in:
2026-01-23 14:08:02 +01:00
parent d70a9f38d4
commit 3d3b8cae22
25 changed files with 3233 additions and 95 deletions

View File

@@ -64,14 +64,14 @@ app.add_middleware(VendorContextMiddleware) # Runs second (existing)
app.add_middleware(PlatformContextMiddleware) # Runs first (NEW)
```
### 2.3 Update VendorContextMiddleware
### 2.3 Update VendorContextMiddleware ✅ COMPLETE
File: `middleware/vendor_context.py`
Changes needed:
- [ ] Use `request.state.platform_clean_path` instead of `request.url.path` for path-based vendor detection
- [ ] Skip vendor detection if no platform found (platform marketing pages like /oms/pricing)
- [ ] Pass platform context to vendor lookup for multi-platform vendor support
Changes completed:
- [x] Use `request.state.platform_clean_path` instead of `request.url.path` for path-based vendor detection (line 52)
- [x] Skip vendor detection if no platform found (platform marketing pages like /oms/pricing)
- [x] Pass platform context to vendor lookup for multi-platform vendor support
### 2.4 Fix Platform Homepage Route
@@ -179,19 +179,19 @@ if settings.environment == "development":
app.mount("/loyalty", loyalty_router)
```
### 5.2 Update Shop Routes
### 5.2 Update Shop Routes ✅ COMPLETE
- [ ] Add platform context to shop routes
- [ ] Use `request.state.platform` for template selection
- [ ] Pass platform to content page lookups
- [x] Add platform context to shop routes (`shop_pages.py` line 117)
- [x] Use `request.state.platform` for template selection
- [x] Pass platform to content page lookups (`platform_id` used in CMS queries)
### 5.3 Test All URL Patterns
### 5.3 Test All URL Patterns ✅ COMPLETE
Development:
- [ ] `localhost:9999/oms/` → OMS homepage
- [ ] `localhost:9999/oms/pricing` → OMS pricing page
- [ ] `localhost:9999/oms/vendors/{code}/` → Vendor storefront
- [ ] `localhost:9999/loyalty/` → Loyalty homepage
Development (using /platforms/ prefix):
- [x] `localhost:9999/platforms/oms/` → OMS homepage
- [x] `localhost:9999/platforms/oms/pricing` → OMS pricing page
- [x] `localhost:9999/platforms/oms/vendors/{code}/` → Vendor storefront
- [x] `localhost:9999/platforms/loyalty/` → Loyalty homepage
---