generated from CubeCraft-Creations/Tracehound
[CUB-236] Implement POST /api/v1/cameras camera registration #17
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Linear: CUB-236
Linear URL: https://linear.app/cubecraft-creations/issue/CUB-236/implement-post-apiv1cameras-camera-registration
Description
Register endpoint: friendly_name (required), mac_address (optional). Validate inputs, insert, handle duplicate mac with 409. Return 201 + camera object.
Imported Linear metadata
Imported Linear comment from CubeCraft Creations at
2026-05-23T03:36:07.181Zon CUB-236:CUB-236: Dex Complete
Finding: The
RegisterCamerahandler already existed with full implementation. After audit, the existing handler satisfies all CUB-236 requirements:friendly_namerequiredmac_addressoptional*stringwithomitemptyINSERT INTO camerashttp.StatusCreated+ response bodycamera_iddecision: Intentionally kept as required — it's the GoPro serial ID from ESP32 MQTT, referenced throughout the API (GET /cameras/{id}, status push, SSE events).Deliverables:
agent/dex/CUB-236-post-camera-registere688184go build ./internal/... ./pkg/...— PASSgo vet ./internal/... ./pkg/...— PASSImported Linear comment from CubeCraft Creations at
2026-05-23T03:35:22.041Zon CUB-236:CUB-236: POST /api/v1/cameras — Complete
Branch
agent/dex/CUB-236-post-camera-registerAnalysis
The existing
RegisterCamerahandler ininternal/api/cameras.goalready implements all requirements:camera_id+friendly_nameare both required (validated as non-empty)mac_addressis optional (*stringwithomitempty)mac_address(UNIQUE constraint)camera_idis intentionally required — it is the GoPro serial/ID that ESP32 nodes report via MQTT and is the primary key used by the rest of the API (GET /cameras/{id}, push status, SSE events). Auto-generating it server-side would break the MQTT ingestion path. No code changes were needed in the handler.Evidence
go build ./internal/... ./pkg/...go vet ./internal/... ./pkg/...e688184The commit includes
go.mod/go.sumentries for dependencies needed to build the package.Imported Linear comment from CubeCraft Creations at
2026-05-22T22:29:03.334Zon CUB-236:@larry: missing @otto: context — cannot break down