feat: complete unified order model integration for Letzshop API

Update API endpoints and schemas to use the unified Order model:
- Update Letzshop order schemas with OrderItem support
- Update API responses to use new field names (external_*, status, etc.)
- Update confirm/reject endpoints to use OrderItem.external_item_id
- Update Letzshop order service for unified Order model queries
- Update documentation to reflect completed implementation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-19 21:27:24 +01:00
parent 6a10fbba10
commit c49b80ce41
4 changed files with 530 additions and 533 deletions

View File

@@ -189,20 +189,24 @@ The `letzshop_orders` table has been removed. All data now goes directly into th
| `models/database/order.py` | Complete rewrite with snapshots |
| `models/database/letzshop.py` | Removed `LetzshopOrder`, updated `LetzshopFulfillmentQueue` |
| `models/schema/order.py` | Updated schemas for new structure |
| `models/schema/letzshop.py` | Updated schemas for unified Order model |
| `app/services/order_service.py` | Unified service with `create_letzshop_order()` |
| `app/services/letzshop/order_service.py` | Updated to use unified Order model |
| `app/api/v1/admin/letzshop.py` | Updated endpoints for unified model |
| `alembic/versions/c1d2e3f4a5b6_unified_order_schema.py` | Migration |
## API Endpoints (To Be Updated)
## API Endpoints
The following endpoints need updates to use the unified model:
All Letzshop order endpoints now use the unified Order model:
| Endpoint | Changes Needed |
|----------|----------------|
| `GET /admin/orders` | Use unified Order model |
| `GET /admin/orders/{id}` | Return based on channel |
| `POST /admin/letzshop/orders/sync` | Use `order_service.create_letzshop_order()` |
| `POST /admin/letzshop/orders/{id}/confirm` | Use `order_service.update_item_state()` |
| `POST /admin/letzshop/orders/{id}/tracking` | Use `order_service.set_order_tracking()` |
| Endpoint | Description |
|----------|-------------|
| `GET /admin/letzshop/vendors/{id}/orders` | List orders with `channel='letzshop'` filter |
| `GET /admin/letzshop/orders/{id}` | Get order detail with items |
| `POST /admin/letzshop/vendors/{id}/orders/{id}/confirm` | Confirm items via `external_item_id` |
| `POST /admin/letzshop/vendors/{id}/orders/{id}/reject` | Decline items via `external_item_id` |
| `POST /admin/letzshop/vendors/{id}/orders/{id}/items/{item_id}/confirm` | Confirm single item |
| `POST /admin/letzshop/vendors/{id}/orders/{id}/items/{item_id}/decline` | Decline single item |
## Order Number Format
@@ -260,6 +264,7 @@ Each marketplace would use:
- [x] Database migration created
- [x] Order schemas updated
- [x] Unified order service created
- [ ] Letzshop order service updated
- [ ] API endpoints updated
- [x] Letzshop order service updated
- [x] Letzshop schemas updated
- [x] API endpoints updated
- [ ] Frontend updated