feat: multi-module improvements across merchant, store, i18n, and customer systems
All checks were successful
All checks were successful
- Fix platform-grouped merchant sidebar menu with core items at root level - Add merchant store management (detail page, create store, team page) - Fix store settings 500 error by removing dead stripe/API tab - Move onboarding translations to module-owned locale files - Fix onboarding banner i18n with server-side rendering + context inheritance - Refactor login language selectors to use languageSelector() function (LANG-002) - Move HTTPException handling to global exception handler in merchant routes (API-003) - Add language selector to all login pages and portal headers - Fix customer module: drop order stats from customer model, add to orders module - Fix admin menu config visibility for super admin platform context - Fix storefront auth and layout issues - Add missing i18n translations for onboarding steps (en/fr/de/lb) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,6 @@ Requires customer authentication for order placement.
|
||||
"""
|
||||
|
||||
import logging
|
||||
from datetime import UTC, datetime
|
||||
|
||||
from fastapi import APIRouter, Depends, Request
|
||||
from sqlalchemy.orm import Session
|
||||
@@ -92,15 +91,21 @@ def place_order(
|
||||
},
|
||||
)
|
||||
|
||||
# Update customer stats
|
||||
customer.total_orders = (customer.total_orders or 0) + 1
|
||||
customer.total_spent = (customer.total_spent or 0) + order.total_amount
|
||||
customer.last_order_date = datetime.now(UTC)
|
||||
db.flush()
|
||||
# Update customer order stats (owned by orders module)
|
||||
from app.modules.orders.services.customer_order_service import (
|
||||
customer_order_service,
|
||||
)
|
||||
|
||||
stats = customer_order_service.record_order(
|
||||
db=db,
|
||||
store_id=store.id,
|
||||
customer_id=customer.id,
|
||||
total_amount_cents=order.total_amount_cents,
|
||||
)
|
||||
|
||||
logger.debug(
|
||||
f"Updated customer stats: total_orders={customer.total_orders}, "
|
||||
f"total_spent={customer.total_spent}"
|
||||
f"Updated customer order stats: total_orders={stats.total_orders}, "
|
||||
f"total_spent_cents={stats.total_spent_cents}"
|
||||
)
|
||||
|
||||
# Clear cart (get session_id from request cookies or headers)
|
||||
|
||||
Reference in New Issue
Block a user