feat(flow): retry failed orders
Add ability to re-import individual ERROR/SKIPPED orders directly from
the order detail modal. Downloads narrow date range from GoMag API,
finds the specific order, and re-runs import_single_order().
Backend:
- New retry_service.py with retry_single_order() — downloads order_date
±1 day from GoMag, finds order by number, imports via import_service
- Guard: blocks retry during active sync (_sync_lock check)
- POST /api/orders/{order_number}/retry endpoint
Frontend:
- "Reimporta" button in modal footer (visible only for ERROR/SKIPPED)
- Spinner during retry, success/error feedback with auto-refresh
Cache-bust: shared.js?v=18
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -484,6 +484,16 @@ async def order_detail(order_number: str):
|
||||
return detail
|
||||
|
||||
|
||||
@router.post("/api/orders/{order_number}/retry")
|
||||
async def retry_order(order_number: str):
|
||||
"""Retry importing a failed/skipped order."""
|
||||
from ..services import retry_service
|
||||
|
||||
app_settings = await sqlite_service.get_app_settings()
|
||||
result = await retry_service.retry_single_order(order_number, app_settings)
|
||||
return result
|
||||
|
||||
|
||||
@router.get("/api/dashboard/orders")
|
||||
async def dashboard_orders(page: int = 1, per_page: int = 50,
|
||||
search: str = "", status: str = "all",
|
||||
|
||||
Reference in New Issue
Block a user