move_detect/server/src/Repository/SnapshotRepository.php
유창욱 bf5255e9eb feat(dashboard): device-status panel + event-list rework, hardened
- Device-status panel (DeviceStatusController): site-scoped liveness over stored
  heartbeat telemetry. Fix config_drift false-positive by storing NULL until the
  device actually reports a version (was firing "설정 미적용" on every device).
- Zone save rejects a blank/unknown device_id (DeviceRepository::exists) so a zone
  is never persisted against a device that will never fetch it.
- Snapshot proxy sends immutable private cache headers, ending the 5s-poll
  re-download of every thumbnail (a Cafe24 traffic-cap hazard).
- Event list: paged-in acknowledgements stick; honesty affordances for the paging
  gap, a stale device poll, and a filtered camera aging out; logout wired for
  every page via the shared layout.
2026-07-25 19:20:42 +09:00

28 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Repository;
interface SnapshotRepository
{
public function add(int $eventId, string $fileUuid, string $contentHash): void;
public function forEvent(int $eventId): array;
public function pathByUuid(string $uuid): ?string;
/** The event_id that owns this snapshot uuid, or null. Lets the proxy resolve a
* snapshot's site (via the owning event) for access control. */
public function eventIdByUuid(string $uuid): ?int;
/** Newest snapshot file_uuid for each of the given event ids, as [event_id => file_uuid].
* Batched (one query) so the event list can show a thumbnail per row without an N+1.
* Events with no snapshot are simply absent from the map. */
public function thumbUuidsFor(array $eventIds): array;
/** Most recent snapshot for a camera, as ['file_uuid' => ..., 'device_id' => ...], or null.
* Backs the zone editor's "load the latest frame" button: an operator draws hazard zones
* over what the camera actually sees instead of guessing coordinates on a blank canvas.
* device_id comes back so the caller can site-scope the result. */
public function latestForCamera(string $cameraId): ?array;
/** Delete snapshot files + rows created before $cutoff (unix ts). PIPA retention:
* worker images must not be kept forever. Returns the number purged. */
public function purgeOlderThan(int $cutoff): int;
}