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:
2026-03-08 20:20:07 +01:00
parent 10d05bd2e7
commit 89c44b846f
14 changed files with 640 additions and 56 deletions
@@ -26,6 +26,7 @@ class AuditLog(Base):
)
read_at: Mapped[datetime | None] = mapped_column(DateTime, nullable=True)
notification: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
channel: Mapped[str] = mapped_column(String(20), nullable=False, default="notification")
tenant_id: Mapped[uuid.UUID | None] = mapped_column(
UUID(as_uuid=True), ForeignKey("tenants.id"), nullable=True, index=True
)
@@ -55,4 +56,5 @@ class NotificationConfig(Base):
event_type: Mapped[str] = mapped_column(String(100), nullable=False)
channel: Mapped[str] = mapped_column(String(20), nullable=False) # "in_app" | "email"
enabled: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
frequency: Mapped[str] = mapped_column(String(20), nullable=False, default="immediate") # "immediate" | "daily" | "never"
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow, nullable=False)