feat: enrich webhook payloads with downstream event table fields

Add missing fields (event_code, camera_ip, started_at, ended_at,
dwell_seconds, is_discarded, alerted_at, etc.) to both batch_event
and case_event payloads. Introduce source_id config for payload
injection and infer_camera_ip to extract IP from RTSP stream URL.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 17:04:58 +08:00
parent e919ffd561
commit 45e2cf70f7
8 changed files with 193 additions and 17 deletions

View File

@@ -138,6 +138,7 @@ zone_ids = ["1", "2", "3"]
"enabled": True,
"event_url": "https://example.com/events",
"case_url": "https://example.com/cases",
"source_id": "cold-display-guard",
"callback_token": "secret",
"connect_timeout_seconds": 3,
"read_timeout_seconds": 5,
@@ -159,6 +160,7 @@ zone_ids = ["1", "2", "3"]
self.assertIn("[webhooks]", text)
self.assertIn('event_url = "https://example.com/events"', text)
self.assertIn('case_url = "https://example.com/cases"', text)
self.assertIn('source_id = "cold-display-guard"', text)
self.assertIn('callback_token = "secret"', text)
self.assertIn("retry_max_attempts = 4", text)
self.assertIn("retry_backoff_seconds = 30", text)