Files
HartOMat/backend/alembic/versions/051_notification_channels.py
Hartmut 89c44b846f 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>
2026-03-08 20:20:07 +01:00

44 lines
1009 B
Python

"""Add channel to audit_log and frequency to notification_configs.
Revision ID: 051
Revises: 050
"""
from alembic import op
import sqlalchemy as sa
revision = "051"
down_revision = "050"
branch_labels = None
depends_on = None
def upgrade() -> None:
# Add channel column to audit_log
op.add_column(
"audit_log",
sa.Column(
"channel",
sa.String(20),
nullable=False,
server_default="notification",
),
)
op.create_index("ix_audit_log_channel", "audit_log", ["channel"])
# Add frequency column to notification_configs
op.add_column(
"notification_configs",
sa.Column(
"frequency",
sa.String(20),
nullable=False,
server_default="immediate",
),
)
def downgrade() -> None:
op.drop_column("notification_configs", "frequency")
op.drop_index("ix_audit_log_channel", table_name="audit_log")
op.drop_column("audit_log", "channel")