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:
@@ -1,5 +1,7 @@
|
||||
import api from './client'
|
||||
|
||||
export type NotificationChannel = 'notification' | 'activity' | 'alert'
|
||||
|
||||
export interface Notification {
|
||||
id: string
|
||||
action: string
|
||||
@@ -8,6 +10,7 @@ export interface Notification {
|
||||
details: Record<string, unknown> | null
|
||||
timestamp: string
|
||||
read_at: string | null
|
||||
channel?: NotificationChannel
|
||||
}
|
||||
|
||||
export interface NotificationListResponse {
|
||||
@@ -20,6 +23,7 @@ export async function getNotifications(params?: {
|
||||
limit?: number
|
||||
offset?: number
|
||||
unread_only?: boolean
|
||||
channel?: NotificationChannel
|
||||
}): Promise<NotificationListResponse> {
|
||||
const { data } = await api.get('/notifications', { params })
|
||||
return data
|
||||
@@ -40,12 +44,15 @@ export async function markOneAsRead(id: string): Promise<void> {
|
||||
|
||||
// ── Notification Config ───────────────────────────────────────────────────
|
||||
|
||||
export type NotificationFrequency = 'immediate' | 'daily' | 'never'
|
||||
|
||||
export interface NotificationConfig {
|
||||
id: string
|
||||
user_id: string
|
||||
event_type: string
|
||||
channel: 'in_app' | 'email'
|
||||
enabled: boolean
|
||||
frequency: NotificationFrequency
|
||||
created_at: string
|
||||
}
|
||||
|
||||
@@ -57,11 +64,14 @@ export async function getNotificationConfigs(): Promise<NotificationConfig[]> {
|
||||
export async function updateNotificationConfig(
|
||||
eventType: string,
|
||||
channel: string,
|
||||
enabled: boolean
|
||||
enabled: boolean,
|
||||
frequency?: NotificationFrequency
|
||||
): Promise<NotificationConfig> {
|
||||
const body: Record<string, unknown> = { enabled }
|
||||
if (frequency !== undefined) body.frequency = frequency
|
||||
const res = await api.put<NotificationConfig>(
|
||||
`/notifications/config/${encodeURIComponent(eventType)}/${channel}`,
|
||||
{ enabled }
|
||||
body
|
||||
)
|
||||
return res.data
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user