Drawing hazard zones on a blank canvas meant guessing pixel coordinates.
The editor can now pull the camera's most recent snapshot and draw over
what the camera actually sees.
- SnapshotRepository::latestForCamera() (+ Pdo/in-memory impls), ordered by
snapshot_id, not the device-reported occurred_at (a skewed Pi RTC would
otherwise pin 'latest' to a stale frame)
- GET /api/cameras/{camera}/latest-snapshot -> {uuid}; returns only the id,
the bytes still go through SnapshotProxy's session + site-scope check.
Out-of-scope and missing both 404, so a scoped operator cannot probe for
another site's cameras
- ix_events_camera (camera_id, event_id) so the lookup is not a full scan
- '현재 화면 불러오기' button in the zone editor
Tests: PHP 113 pass (4 skipped, 4 new), pytest 174 pass.
23 lines
1.1 KiB
SQL
23 lines
1.1 KiB
SQL
-- cloud/migrations/2026-07-20-move-table-prefix.sql
|
|
-- Rename every P1-B table to the `move_` prefix (shared-hosting DB co-tenancy).
|
|
-- Run ONCE in phpMyAdmin BEFORE deploying code that reads the prefixed names.
|
|
-- Fresh installs: skip this, cloud/schema.sql already creates prefixed tables.
|
|
--
|
|
-- RENAME TABLE is atomic across all pairs and preserves indexes, constraints
|
|
-- and FKs (fk_event_snapshots_event follows its parent automatically).
|
|
|
|
RENAME TABLE
|
|
users TO move_users,
|
|
devices TO move_devices,
|
|
cameras TO move_cameras,
|
|
zones TO move_zones,
|
|
events TO move_events,
|
|
event_snapshots TO move_event_snapshots,
|
|
thresholds TO move_thresholds,
|
|
nonces TO move_nonces,
|
|
rate_limits TO move_rate_limits,
|
|
audit_log TO move_audit_log;
|
|
|
|
-- Zone-editor background frame: SELECT ... FROM move_event_snapshots JOIN move_events
|
|
-- WHERE e.camera_id = ? would otherwise full-scan an unbounded table on an interactive page.
|
|
ALTER TABLE move_events ADD INDEX ix_events_camera (camera_id, event_id);
|