5a9f44f3d1
Complete shop API consolidation to /api/v1/shop/* with middleware-based vendor context
...
## API Migration (Complete)
### New Shop API Endpoints Created
- **Products API** (app/api/v1/shop/products.py)
- GET /api/v1/shop/products - Product catalog with pagination/search/filters
- GET /api/v1/shop/products/{id} - Product details
- **Cart API** (app/api/v1/shop/cart.py)
- GET /api/v1/shop/cart/{session_id} - Get cart
- POST /api/v1/shop/cart/{session_id}/items - Add to cart
- PUT /api/v1/shop/cart/{session_id}/items/{product_id} - Update quantity
- DELETE /api/v1/shop/cart/{session_id}/items/{product_id} - Remove item
- DELETE /api/v1/shop/cart/{session_id} - Clear cart
- **Orders API** (app/api/v1/shop/orders.py)
- POST /api/v1/shop/orders - Place order (authenticated)
- GET /api/v1/shop/orders - Order history (authenticated)
- GET /api/v1/shop/orders/{id} - Order details (authenticated)
- **Auth API** (app/api/v1/shop/auth.py)
- POST /api/v1/shop/auth/register - Customer registration
- POST /api/v1/shop/auth/login - Customer login (sets cookie at path=/shop)
- POST /api/v1/shop/auth/logout - Customer logout
- POST /api/v1/shop/auth/forgot-password - Password reset request
- POST /api/v1/shop/auth/reset-password - Password reset
**Total: 18 new shop API endpoints**
### Middleware Enhancement
Updated VendorContextMiddleware (middleware/vendor_context.py):
- Added is_shop_api_request() to detect /api/v1/shop/* routes
- Added extract_vendor_from_referer() to extract vendor from Referer header
- Supports path-based: /vendors/wizamart/shop/* → wizamart
- Supports subdomain: wizamart.platform.com → wizamart
- Supports custom domain: customshop.com → customshop.com
- Modified dispatch() to handle shop API specially (no longer skips)
- Vendor context now injected into request.state.vendor for shop API calls
### Frontend Migration (Complete)
Updated all shop templates to use new API endpoints:
- app/templates/shop/account/login.html - Updated login endpoint
- app/templates/shop/account/register.html - Updated register endpoint
- app/templates/shop/product.html - Updated 4 API calls (products, cart)
- app/templates/shop/cart.html - Updated 3 API calls (get, update, delete)
- app/templates/shop/products.html - Activated product loading from API
**Total: 9 API endpoint migrations across 5 templates**
### Old Endpoint Cleanup (Complete)
Removed deprecated /api/v1/public/vendors/* shop endpoints:
- Deleted app/api/v1/public/vendors/auth.py
- Deleted app/api/v1/public/vendors/products.py
- Deleted app/api/v1/public/vendors/cart.py
- Deleted app/api/v1/public/vendors/orders.py
- Deleted app/api/v1/public/vendors/payments.py (empty)
- Deleted app/api/v1/public/vendors/search.py (empty)
- Deleted app/api/v1/public/vendors/shop.py (empty)
Updated app/api/v1/public/__init__.py to only include vendor lookup endpoints:
- GET /api/v1/public/vendors/by-code/{code}
- GET /api/v1/public/vendors/by-subdomain/{subdomain}
- GET /api/v1/public/vendors/{id}/info
**Result: Only 3 truly public endpoints remain**
### Error Page Improvements
Updated all shop error templates to use base_url:
- app/templates/shop/errors/*.html (10 files)
- Updated error_renderer.py to calculate base_url from vendor context
- Links now work correctly for path-based, subdomain, and custom domain access
### CMS Route Handler
Added catch-all CMS route to app/routes/vendor_pages.py:
- Handles /{vendor_code}/{slug} for content pages
- Uses content_page_service for two-tier lookup (vendor override → platform default)
### Template Architecture Fix
Updated app/templates/shop/base.html:
- Changed x-data to use {% block alpine_data %} for component override
- Allows pages to specify custom Alpine.js components
- Enables page-specific state while extending shared shopLayoutData()
### Documentation (Complete)
Created comprehensive documentation:
- docs/api/shop-api-reference.md - Complete API reference with examples
- docs/architecture/API_CONSOLIDATION_PROPOSAL.md - Analysis of 3 options
- docs/architecture/API_MIGRATION_STATUS.md - Migration tracking (100% complete)
- Updated docs/api/index.md - Added Shop API section
- Updated docs/frontend/shop/architecture.md - New API structure and component pattern
## Benefits Achieved
### Cleaner URLs (~40% shorter)
Before: /api/v1/public/vendors/{vendor_id}/products
After: /api/v1/shop/products
### Better Architecture
- Middleware-driven vendor context (no manual vendor_id passing)
- Proper separation of concerns (public vs shop vs vendor APIs)
- Consistent authentication pattern
- RESTful design
### Developer Experience
- No need to track vendor_id in frontend state
- Automatic vendor context from Referer header
- Simpler API calls
- Better documentation
## Testing
- Verified middleware extracts vendor from Referer correctly
- Tested all shop API endpoints with vendor context
- Confirmed products page loads and displays products
- Verified error pages show correct links
- No old API references remain in templates
Migration Status: ✅ 100% Complete (8/8 success criteria met)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-22 23:03:05 +01:00
c1ff0a00db
fix: correct authentication dependency names in CMS API endpoints
...
Fix ImportError by using correct authentication dependency names:
- Use get_current_admin_api instead of get_current_admin_user
- Use get_current_vendor_api instead of get_current_vendor_user
These are the correct dependency names for API endpoints that require
Authorization header authentication (no cookie support).
Fixes: ImportError: cannot import name 'get_current_admin_user'
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-22 15:59:15 +01:00
fb3aa89086
feat: add CMS service layer and API endpoints
...
Implement complete CMS business logic and REST API:
Service Layer (content_page_service.py):
- get_page_for_vendor() - Two-tier lookup with fallback
- list_pages_for_vendor() - Merge vendor + platform pages
- create_page(), update_page(), delete_page() - CRUD operations
- Support for published/draft workflow
- Footer/header navigation filtering
API Endpoints:
Admin API (/api/v1/admin/content-pages):
- POST /platform - Create platform defaults
- GET /platform - List platform defaults
- GET / - List all pages with vendor filtering
- PUT /{id} - Update any page
- DELETE /{id} - Delete any page
Vendor API (/api/v1/vendor/{code}/content-pages):
- GET / - List available pages (vendor + platform merged)
- GET /overrides - List only vendor overrides
- POST / - Create vendor override
- PUT /{id} - Update vendor page
- DELETE /{id} - Delete vendor page
Shop API (/api/v1/shop/content-pages):
- GET /navigation - Get footer/header navigation pages
- GET /{slug} - Get specific page (public, with fallback)
All endpoints include proper authentication, authorization,
and validation using Pydantic schemas.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-22 15:54:48 +01:00
608fa8b95c
Fixed login redirecting issues
2025-11-21 23:38:03 +01:00
86f1e16ef2
Fixing vendor dashboard area
2025-11-21 23:15:25 +01:00
e3ed4a3295
data seed feature for demo and prod
2025-11-15 20:57:39 +01:00
41439eed09
Vendor team member management features
2025-11-14 21:08:57 +01:00
79dfcab09f
frontend error management enhancement
2025-11-05 21:52:22 +01:00
e4bc438069
revamped authentication system
2025-11-02 18:40:03 +01:00
9cc92e5fc4
created specific route files for frontends
2025-11-02 15:26:55 +01:00
9611c03a36
migrating vendor frontend to new architecture
2025-10-31 20:51:30 +01:00
b0cc0385f8
revamping frontend logging system and reorganising documentation
2025-10-28 21:07:26 +01:00
5c80ba17c5
Main exception renamed to WizamartException
2025-10-27 21:55:05 +01:00
1e0cbf5927
Multitenant implementation with custom Domain, theme per vendor
2025-10-26 23:49:29 +01:00
c88775134d
Multitenant implementation with custom Domain, theme per vendor
2025-10-26 20:05:02 +01:00
49890d4cbe
adding developer tools in admin panel, adding vendor management
2025-10-25 18:07:02 +02:00
7bb69a9a96
fix vendor edit page in admin panel
2025-10-25 11:06:06 +02:00
1a43a4250c
admin panel migration to jinja
2025-10-25 07:31:44 +02:00
13ae656a49
Migration to jinja
2025-10-25 07:30:02 +02:00
0cff957613
Stats management revamping
2025-10-25 07:26:07 +02:00
3631766d28
Stats management revamping
2025-10-25 07:25:36 +02:00
5be47b91a2
Working state before icon/utils fixes - Oct 22
2025-10-21 21:56:54 +02:00
6db0187b54
Admin features (audit, log, settings)
2025-10-19 16:04:44 +02:00
9aee314837
vendor features for admin and vendor admin area
2025-10-19 16:03:25 +02:00
06bb463468
Bug fix in init files
2025-10-19 15:59:12 +02:00
d7439fce46
Created target project structure
2025-10-11 12:14:49 +02:00
1e2f211057
Renamed schemas to schema as per naming conventions
2025-10-11 12:14:11 +02:00
dd16198276
major refactoring adding vendor and customer features
2025-10-11 09:09:25 +02:00
0114b6c46e
shop product refactoring
2025-10-04 23:38:53 +02:00
4d2866af5e
shop product refactoring
2025-10-04 21:27:48 +02:00
c971674ec2
marketplace refactoring
2025-10-04 13:38:10 +02:00
6b9817f179
test updates to take into account exception management
2025-09-27 13:47:36 +02:00
cea88a46c5
Marketplace tests update
2025-09-24 22:28:44 +02:00
98285aa8aa
Exception handling enhancement
2025-09-23 22:42:26 +02:00
2db03b20c5
Renaming models/api/ folder to models/schemas/
2025-09-21 21:02:05 +02:00
c2a1056db7
QC check
2025-09-21 13:00:10 +02:00
c494c5b5c6
API and database models refactoring
2025-09-20 20:17:16 +02:00
f042616fdd
fixing DQ issues
2025-09-19 16:54:13 +02:00
0ce708cf09
fixing DQ issues
2025-09-14 15:47:38 +02:00
3eb18ef91e
code quality run
2025-09-13 21:58:54 +02:00
b9fe91ab88
Application fully migrated to modular approach
2025-09-13 21:30:40 +02:00
12e0d64484
Refactoring code for modular approach
2025-09-11 22:18:31 +02:00
6507b74191
Refactoring code for modular approach
2025-09-11 22:06:10 +02:00
f9ed3bdf11
Refactoring code for modular approach
2025-09-11 21:16:18 +02:00
900229d452
Refactoring code for modular approach
2025-09-11 20:59:40 +02:00
1fc8810242
Refactoring code for modular approach
2025-09-09 23:03:08 +02:00
8fbe64687a
Refactoring code for modular approach
2025-09-09 22:07:21 +02:00
71153a1ff5
Refactoring code for modular approach
2025-09-09 21:27:58 +02:00