feat(phase5.1+6): fallback material cleanup + notification batch refactor
Phase 5.1 — MATERIAL_PALETTE removal:
- Remove MATERIAL_PALETTE + _material_to_color() from step_processor.py
- build_part_colors() now returns {part→material_name} for Blender resolver
Phase 6 — Notification Center Refactor:
- Migration 051: add channel (activity|notification|alert) to audit_log,
add frequency (immediate|daily|never) to notification_configs
- Three notification channels: activity (per-render), notification (batch
order summaries), alert (admin infrastructure)
- Per-render emit_notification_sync calls demoted to channel=activity
- New emit_batch_render_notification_sync(): single summary notification
when all order lines reach terminal state ("47/50 succeeded, 3 failed")
- Beat task batch_render_notifications every 60s: safety-net for missed
batch notifications after order completion
- GET /notifications: defaults to channel IN (notification, alert);
accepts ?channel=activity for activity feed
- Unread count badge counts only notification+alert channels
- Notifications.tsx: three tabs (Notifications | Activity | Alerts)
- NotificationSettings.tsx: frequency dropdown per event type
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -81,19 +81,12 @@ def check_order_completion(order_id: str) -> bool:
|
||||
session.commit()
|
||||
logger.info(f"Order {order_id} auto-advanced to completed (all {len(lines)} lines done)")
|
||||
|
||||
# Notify order creator
|
||||
# Emit a single batch notification summarising all render results
|
||||
try:
|
||||
from app.domains.notifications.service import emit_notification_sync
|
||||
emit_notification_sync(
|
||||
actor_user_id=None,
|
||||
target_user_id=str(order.created_by),
|
||||
action="order.completed",
|
||||
entity_type="order",
|
||||
entity_id=str(order_id),
|
||||
details={"order_number": order.order_number},
|
||||
)
|
||||
from app.domains.notifications.service import emit_batch_render_notification_sync
|
||||
emit_batch_render_notification_sync(order_id)
|
||||
except Exception:
|
||||
logger.exception("Failed to emit order.completed notification")
|
||||
logger.exception("Failed to emit batch render notification for order %s", order_id)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user