mirror of
https://github.com/BetterCorp/BetterFrame.git
synced 2026-05-26 16:56:33 +00:00
feat(events): mark subscriptions active on event receipt
When /api/kiosk/event receives an ONVIF event, call markEventReceived(camera_id, topic) to flip subscription status from pending → active (orange → green in admin UI). Also added event_source/event_sink fields to subscription mapper. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2592a18564
commit
24f9532adf
2 changed files with 7 additions and 0 deletions
|
|
@ -709,6 +709,11 @@ function registerKioskRoutes(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mark event subscription as active (turns orange → green in admin UI)
|
||||||
|
if (body.camera_id != null && body.topic) {
|
||||||
|
repo.markEventReceived(body.camera_id, body.topic).catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
// Best-effort forward to Node-RED. Topics that have a dedicated trigger
|
// Best-effort forward to Node-RED. Topics that have a dedicated trigger
|
||||||
// node (bf-trigger-layout-changed etc.) expect a FLAT payload matching
|
// node (bf-trigger-layout-changed etc.) expect a FLAT payload matching
|
||||||
// what the admin-side emit produces — splat body.payload up to the top
|
// what the admin-side emit produces — splat body.payload up to the top
|
||||||
|
|
|
||||||
|
|
@ -482,6 +482,8 @@ export function rowToCameraEventSubscription(r: Row): CameraEventSubscription {
|
||||||
topic: s(r["topic"]),
|
topic: s(r["topic"]),
|
||||||
status: s(r["status"]) as EventSubscriptionStatus,
|
status: s(r["status"]) as EventSubscriptionStatus,
|
||||||
subscribed_by_kiosk_id: nn(r["subscribed_by_kiosk_id"]),
|
subscribed_by_kiosk_id: nn(r["subscribed_by_kiosk_id"]),
|
||||||
|
event_source: sn(r["event_source"]),
|
||||||
|
event_sink: sn(r["event_sink"]),
|
||||||
last_event_at: sn(r["last_event_at"]),
|
last_event_at: sn(r["last_event_at"]),
|
||||||
error_message: sn(r["error_message"]),
|
error_message: sn(r["error_message"]),
|
||||||
created_at: s(r["created_at"]),
|
created_at: s(r["created_at"]),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue