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>
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
# Multi-Platform CMS Architecture - Implementation Plan
|
||||
|
||||
> **Status:** All Phases Complete (1-6)
|
||||
> **Status:** All Phases Complete (1-7)
|
||||
> **Last Updated:** 2026-01-19
|
||||
> **Commits:**
|
||||
> - `408019d` (Phase 1: Database & Models)
|
||||
> - `9680026` (Phases 2-5: Migration, Admin, Docs, Vendor Dashboard)
|
||||
> - `32bcbc8` (Phase 6: Loyalty Platform Setup)
|
||||
> - `a2407ae` (Phase 7: Platform URL Routing Strategy)
|
||||
|
||||
---
|
||||
|
||||
@@ -227,18 +228,79 @@ Inserts Loyalty platform with:
|
||||
|
||||
---
|
||||
|
||||
## Documentation Requirements ✅ PARTIAL
|
||||
## Phase 7: Platform URL Routing Strategy ✅ COMPLETE
|
||||
|
||||
### 7.1 URL Structure Changes
|
||||
|
||||
**Previous approach (DEPRECATED):**
|
||||
- Development: `/oms/`, `/loyalty/` (first path segment = platform)
|
||||
- Ambiguity: `/faq` could be platform or page
|
||||
|
||||
**New approach:**
|
||||
- Development: `/platforms/oms/`, `/platforms/loyalty/` (explicit prefix)
|
||||
- Main marketing site: `/` (no prefix) → `main` platform
|
||||
- Clear separation: `/faq` = main site, `/platforms/oms/faq` = OMS
|
||||
|
||||
### 7.2 Implementation Details
|
||||
|
||||
| Task | File | Status |
|
||||
|------|------|--------|
|
||||
| Update middleware URL detection | `middleware/platform_context.py` | ✅ |
|
||||
| Change DEFAULT_PLATFORM_CODE | `middleware/platform_context.py` | ✅ |
|
||||
| Remove hardcoded /oms, /loyalty routes | `main.py` | ✅ |
|
||||
| Update platform_pages.py homepage | `app/routes/platform_pages.py` | ✅ |
|
||||
| Add 'main' platform migration | `alembic/versions/z6g7h8i9j0k1_...py` | ✅ |
|
||||
|
||||
### 7.3 URL Routing Summary
|
||||
|
||||
| Platform | Code | Dev URL | Prod URL |
|
||||
|----------|------|---------|----------|
|
||||
| Main Marketing | `main` | `localhost:9999/` | `wizamart.lu/` |
|
||||
| OMS | `oms` | `localhost:9999/platforms/oms/` | `oms.lu/` |
|
||||
| Loyalty | `loyalty` | `localhost:9999/platforms/loyalty/` | `loyalty.lu/` |
|
||||
|
||||
### 7.4 Middleware Detection Logic
|
||||
|
||||
```
|
||||
Request arrives
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────┐
|
||||
│ Production domain? (oms.lu, etc.) │
|
||||
└─────────────────────────────────────┘
|
||||
│ YES → Route to that platform
|
||||
│
|
||||
▼ NO (localhost)
|
||||
┌─────────────────────────────────────┐
|
||||
│ Path starts with /platforms/{code}? │
|
||||
└─────────────────────────────────────┘
|
||||
│ YES → Strip prefix, route to platform
|
||||
│ /platforms/oms/pricing → /pricing
|
||||
│
|
||||
▼ NO
|
||||
┌─────────────────────────────────────┐
|
||||
│ Use 'main' platform (DEFAULT) │
|
||||
│ /faq → Main site FAQ page │
|
||||
└─────────────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Documentation Requirements ✅ COMPLETE
|
||||
|
||||
### Architecture Documentation ✅ COMPLETE
|
||||
|
||||
Created `docs/architecture/multi-platform-cms.md`:
|
||||
Updated documentation for Phase 7:
|
||||
- [x] `docs/architecture/url-routing/overview.md` - Multi-platform URL routing section
|
||||
- [x] `docs/architecture/multi-platform-cms.md` - Request flow with path rewriting
|
||||
- [x] `docs/architecture/middleware.md` - PlatformContextMiddleware documentation
|
||||
- [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
|
||||
- [x] Adding new platform guide with URL summary
|
||||
|
||||
### API Documentation
|
||||
|
||||
@@ -253,6 +315,7 @@ Included in `docs/architecture/multi-platform-cms.md`:
|
||||
- [x] Step-by-step platform creation
|
||||
- [x] Required database records
|
||||
- [x] Key files reference
|
||||
- [x] Platform URL summary table
|
||||
|
||||
---
|
||||
|
||||
@@ -297,17 +360,34 @@ Customer visits: oms.lu/vendors/wizamart/about
|
||||
|
||||
---
|
||||
|
||||
## Next Session Checklist
|
||||
## Verification Checklist
|
||||
|
||||
Start here when resuming work:
|
||||
All phases are complete. Use these commands to verify:
|
||||
|
||||
1. [ ] Run `alembic upgrade head` (backup DB first!)
|
||||
2. [ ] Verify migration: `SELECT * FROM platforms;`
|
||||
3. [ ] Register PlatformContextMiddleware in `main.py`
|
||||
4. [ ] Update VendorContextMiddleware to use `platform_clean_path`
|
||||
5. [ ] Fix platform homepage to use CMS
|
||||
6. [ ] Test: `localhost:9999/oms/` shows CMS homepage
|
||||
7. [ ] Test: Three-tier resolution works
|
||||
```bash
|
||||
# 1. Check platforms in database
|
||||
psql -d wizamart -c "SELECT code, name, domain FROM platforms;"
|
||||
# Expected: main, oms, loyalty
|
||||
|
||||
# 2. Test main marketing site
|
||||
curl -s localhost:9999/ | grep -o "<title>.*</title>"
|
||||
# Expected: Main marketing site title
|
||||
|
||||
# 3. Test OMS platform
|
||||
curl -s localhost:9999/platforms/oms/ | grep -o "<title>.*</title>"
|
||||
# Expected: OMS platform title
|
||||
|
||||
# 4. Test Loyalty platform
|
||||
curl -s localhost:9999/platforms/loyalty/ | grep -o "<title>.*</title>"
|
||||
# Expected: Loyalty platform title
|
||||
|
||||
# 5. Verify middleware detection
|
||||
python -c "
|
||||
from middleware.platform_context import PlatformContextMiddleware, DEFAULT_PLATFORM_CODE
|
||||
print(f'DEFAULT_PLATFORM_CODE: {DEFAULT_PLATFORM_CODE}')
|
||||
# Expected: main
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user