diff --git a/backend/app/api/routes/notification_templates.py b/backend/app/api/routes/notification_templates.py index ea5d20819..b47004072 100644 --- a/backend/app/api/routes/notification_templates.py +++ b/backend/app/api/routes/notification_templates.py @@ -32,6 +32,14 @@ EVENT_NAMES = { "filament_low": "Filament Low", "maintenance_due": "Maintenance Due", "test": "Test Notification", + # Queue notifications + "queue_job_added": "Queue Job Added", + "queue_job_assigned": "Queue Job Assigned", + "queue_job_started": "Queue Job Started", + "queue_job_waiting": "Queue Job Waiting", + "queue_job_skipped": "Queue Job Skipped", + "queue_job_failed": "Queue Job Failed", + "queue_completed": "Queue Completed", } diff --git a/backend/app/schemas/notification_template.py b/backend/app/schemas/notification_template.py index c484e0586..544a3c57e 100644 --- a/backend/app/schemas/notification_template.py +++ b/backend/app/schemas/notification_template.py @@ -45,6 +45,14 @@ EVENT_VARIABLES: dict[str, list[str]] = { "ams_humidity_high": ["printer", "ams_label", "humidity", "threshold", "timestamp", "app_name"], "ams_temperature_high": ["printer", "ams_label", "temperature", "threshold", "timestamp", "app_name"], "test": ["app_name", "timestamp"], + # Queue notifications + "queue_job_added": ["job_name", "target", "timestamp", "app_name"], + "queue_job_assigned": ["job_name", "printer", "target_model", "timestamp", "app_name"], + "queue_job_started": ["printer", "job_name", "estimated_time", "timestamp", "app_name"], + "queue_job_waiting": ["job_name", "target_model", "waiting_reason", "timestamp", "app_name"], + "queue_job_skipped": ["printer", "job_name", "reason", "timestamp", "app_name"], + "queue_job_failed": ["printer", "job_name", "reason", "timestamp", "app_name"], + "queue_completed": ["completed_count", "timestamp", "app_name"], } # Sample data for previewing templates @@ -136,6 +144,53 @@ SAMPLE_DATA: dict[str, dict[str, str]] = { "app_name": "Bambuddy", "timestamp": "2024-01-15 14:30", }, + # Queue notifications + "queue_job_added": { + "job_name": "Benchy.3mf", + "target": "Bambu X1C", + "timestamp": "2024-01-15 14:30", + "app_name": "Bambuddy", + }, + "queue_job_assigned": { + "job_name": "Benchy.3mf", + "printer": "Bambu X1C #1", + "target_model": "X1C", + "timestamp": "2024-01-15 14:30", + "app_name": "Bambuddy", + }, + "queue_job_started": { + "printer": "Bambu X1C", + "job_name": "Benchy.3mf", + "estimated_time": "1h 23m", + "timestamp": "2024-01-15 14:30", + "app_name": "Bambuddy", + }, + "queue_job_waiting": { + "job_name": "Benchy.3mf", + "target_model": "X1C", + "waiting_reason": "Printer1 (needs PLA)", + "timestamp": "2024-01-15 14:30", + "app_name": "Bambuddy", + }, + "queue_job_skipped": { + "printer": "Bambu X1C", + "job_name": "Benchy.3mf", + "reason": "Previous print failed", + "timestamp": "2024-01-15 14:30", + "app_name": "Bambuddy", + }, + "queue_job_failed": { + "printer": "Bambu X1C", + "job_name": "Benchy.3mf", + "reason": "Upload failed: connection timeout", + "timestamp": "2024-01-15 14:30", + "app_name": "Bambuddy", + }, + "queue_completed": { + "completed_count": "5", + "timestamp": "2024-01-15 18:30", + "app_name": "Bambuddy", + }, }