refactor: rename public routes and templates to platform
Complete the public -> platform naming migration across the codebase. This aligns with the naming convention where "platform" refers to the marketing/public-facing pages of the platform itself. Changes: - Update all imports from public to platform modules - Update template references from public/ to platform/ - Update route registrations to use platform prefix - Update documentation to reflect new naming - Update test files for platform API endpoints Files affected: - app/api/main.py - router imports - app/modules/*/routes/*/platform.py - route definitions - app/modules/*/templates/*/platform/ - template files - app/modules/routes.py - route discovery - docs/* - documentation updates - tests/integration/api/v1/platform/ - test files Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -174,15 +174,15 @@ Updated all shop templates to use new API endpoints:
|
||||
|
||||
| Template | Old Endpoint | New Endpoint | Status |
|
||||
|----------|-------------|--------------|---------|
|
||||
| `shop/account/login.html` | `/api/v1/public/vendors/${id}/customers/login` | `/api/v1/shop/auth/login` | ✅ Complete |
|
||||
| `shop/account/register.html` | `/api/v1/public/vendors/${id}/customers/register` | `/api/v1/shop/auth/register` | ✅ Complete |
|
||||
| `shop/product.html` | `/api/v1/public/vendors/${id}/products/${pid}` | `/api/v1/shop/products/${pid}` | ✅ Complete |
|
||||
| `shop/product.html` | `/api/v1/public/vendors/${id}/products?limit=4` | `/api/v1/shop/products?limit=4` | ✅ Complete |
|
||||
| `shop/product.html` | `/api/v1/public/vendors/${id}/cart/${sid}` | `/api/v1/shop/cart/${sid}` | ✅ Complete |
|
||||
| `shop/product.html` | `/api/v1/public/vendors/${id}/cart/${sid}/items` | `/api/v1/shop/cart/${sid}/items` | ✅ Complete |
|
||||
| `shop/cart.html` | `/api/v1/public/vendors/${id}/cart/${sid}` | `/api/v1/shop/cart/${sid}` | ✅ Complete |
|
||||
| `shop/cart.html` | `/api/v1/public/vendors/${id}/cart/${sid}/items/${pid}` (PUT) | `/api/v1/shop/cart/${sid}/items/${pid}` | ✅ Complete |
|
||||
| `shop/cart.html` | `/api/v1/public/vendors/${id}/cart/${sid}/items/${pid}` (DELETE) | `/api/v1/shop/cart/${sid}/items/${pid}` | ✅ Complete |
|
||||
| `shop/account/login.html` | `/api/v1/platform/vendors/${id}/customers/login` | `/api/v1/shop/auth/login` | ✅ Complete |
|
||||
| `shop/account/register.html` | `/api/v1/platform/vendors/${id}/customers/register` | `/api/v1/shop/auth/register` | ✅ Complete |
|
||||
| `shop/product.html` | `/api/v1/platform/vendors/${id}/products/${pid}` | `/api/v1/shop/products/${pid}` | ✅ Complete |
|
||||
| `shop/product.html` | `/api/v1/platform/vendors/${id}/products?limit=4` | `/api/v1/shop/products?limit=4` | ✅ Complete |
|
||||
| `shop/product.html` | `/api/v1/platform/vendors/${id}/cart/${sid}` | `/api/v1/shop/cart/${sid}` | ✅ Complete |
|
||||
| `shop/product.html` | `/api/v1/platform/vendors/${id}/cart/${sid}/items` | `/api/v1/shop/cart/${sid}/items` | ✅ Complete |
|
||||
| `shop/cart.html` | `/api/v1/platform/vendors/${id}/cart/${sid}` | `/api/v1/shop/cart/${sid}` | ✅ Complete |
|
||||
| `shop/cart.html` | `/api/v1/platform/vendors/${id}/cart/${sid}/items/${pid}` (PUT) | `/api/v1/shop/cart/${sid}/items/${pid}` | ✅ Complete |
|
||||
| `shop/cart.html` | `/api/v1/platform/vendors/${id}/cart/${sid}/items/${pid}` (DELETE) | `/api/v1/shop/cart/${sid}/items/${pid}` | ✅ Complete |
|
||||
| `shop/products.html` | Already using `/api/v1/shop/products` | (No change needed) | ✅ Already Updated |
|
||||
| `shop/home.html` | Already using `/api/v1/shop/products?featured=true` | (No change needed) | ✅ Already Updated |
|
||||
|
||||
@@ -196,7 +196,7 @@ grep -r "api/v1/public/vendors" app/templates/shop --include="*.html"
|
||||
|
||||
### ✅ Phase 3: Old Endpoint Cleanup (COMPLETE)
|
||||
|
||||
Cleaned up old `/api/v1/public/vendors/*` endpoints:
|
||||
Cleaned up old `/api/v1/platform/vendors/*` endpoints:
|
||||
|
||||
**Files Removed:**
|
||||
- ❌ `auth.py` - Migrated to `/api/v1/shop/auth.py`
|
||||
@@ -209,14 +209,14 @@ Cleaned up old `/api/v1/public/vendors/*` endpoints:
|
||||
|
||||
**Files Kept:**
|
||||
- ✅ `vendors.py` - Vendor lookup endpoints (truly public, not shop-specific)
|
||||
- `GET /api/v1/public/vendors/by-code/{vendor_code}`
|
||||
- `GET /api/v1/public/vendors/by-subdomain/{subdomain}`
|
||||
- `GET /api/v1/public/vendors/{vendor_id}/info`
|
||||
- `GET /api/v1/platform/vendors/by-code/{vendor_code}`
|
||||
- `GET /api/v1/platform/vendors/by-subdomain/{subdomain}`
|
||||
- `GET /api/v1/platform/vendors/{vendor_id}/info`
|
||||
|
||||
**Updated:**
|
||||
- ✅ `/app/api/v1/public/__init__.py` - Now only includes vendor lookup endpoints
|
||||
- ✅ `/app/api/v1/platform/__init__.py` - Now only includes vendor lookup endpoints
|
||||
|
||||
**Result:** Old shop endpoints completely removed, only vendor lookup remains in `/api/v1/public/vendors/*`
|
||||
**Result:** Old shop endpoints completely removed, only vendor lookup remains in `/api/v1/platform/vendors/*`
|
||||
|
||||
### ⚠️ Phase 4: Deprecation Warnings (SKIPPED - Not Needed)
|
||||
|
||||
@@ -252,16 +252,16 @@ Old endpoint cleanup completed immediately (no gradual migration needed):
|
||||
|
||||
1. ✅ Removed old endpoint files:
|
||||
```bash
|
||||
rm app/api/v1/public/vendors/products.py
|
||||
rm app/api/v1/public/vendors/cart.py
|
||||
rm app/api/v1/public/vendors/orders.py
|
||||
rm app/api/v1/public/vendors/auth.py
|
||||
rm app/api/v1/public/vendors/payments.py
|
||||
rm app/api/v1/public/vendors/search.py
|
||||
rm app/api/v1/public/vendors/shop.py
|
||||
rm app/api/v1/platform/vendors/products.py
|
||||
rm app/api/v1/platform/vendors/cart.py
|
||||
rm app/api/v1/platform/vendors/orders.py
|
||||
rm app/api/v1/platform/vendors/auth.py
|
||||
rm app/api/v1/platform/vendors/payments.py
|
||||
rm app/api/v1/platform/vendors/search.py
|
||||
rm app/api/v1/platform/vendors/shop.py
|
||||
```
|
||||
|
||||
2. ✅ Updated `/api/v1/public/__init__.py`:
|
||||
2. ✅ Updated `/api/v1/platform/__init__.py`:
|
||||
```python
|
||||
# Only import vendor lookup endpoints
|
||||
from .vendors import vendors
|
||||
@@ -280,12 +280,12 @@ Old endpoint cleanup completed immediately (no gradual migration needed):
|
||||
### Before (Old Pattern)
|
||||
```
|
||||
# Verbose - requires vendor_id everywhere
|
||||
/api/v1/public/vendors/123/products
|
||||
/api/v1/public/vendors/123/products/456
|
||||
/api/v1/public/vendors/123/cart/abc-session-id
|
||||
/api/v1/public/vendors/123/cart/abc-session-id/items
|
||||
/api/v1/public/vendors/123/customers/789/orders
|
||||
/api/v1/public/vendors/auth/123/customers/login
|
||||
/api/v1/platform/vendors/123/products
|
||||
/api/v1/platform/vendors/123/products/456
|
||||
/api/v1/platform/vendors/123/cart/abc-session-id
|
||||
/api/v1/platform/vendors/123/cart/abc-session-id/items
|
||||
/api/v1/platform/vendors/123/customers/789/orders
|
||||
/api/v1/platform/vendors/auth/123/customers/login
|
||||
```
|
||||
|
||||
### After (New Pattern)
|
||||
|
||||
Reference in New Issue
Block a user